diff options
author | Zuul <zuul@review.opendev.org> | 2021-10-04 18:32:28 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-10-04 18:32:28 +0000 |
commit | dccfd35c1d81883294eb83e2da91f80d4bd2c30a (patch) | |
tree | b95ded37ebf913314d2456d9ea4ca5177ec2d0ef /osprofiler/_utils.py | |
parent | e475de6c67be2e3825e51895a6d1d86b1a576d45 (diff) | |
parent | adc39e86acb1c705d39e1abd908018e5e6b2f4c5 (diff) | |
download | osprofiler-dccfd35c1d81883294eb83e2da91f80d4bd2c30a.tar.gz |
Merge "Remove six"
Diffstat (limited to 'osprofiler/_utils.py')
-rw-r--r-- | osprofiler/_utils.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/osprofiler/_utils.py b/osprofiler/_utils.py index c23d600..7563fb5 100644 --- a/osprofiler/_utils.py +++ b/osprofiler/_utils.py @@ -22,7 +22,6 @@ import uuid from oslo_utils import secretutils from oslo_utils import uuidutils -import six def split(text, strip=True): @@ -32,7 +31,7 @@ def split(text, strip=True): """ if isinstance(text, (tuple, list)): return text - if not isinstance(text, six.string_types): + if not isinstance(text, str): raise TypeError("Unknown how to split '%s': %s" % (text, type(text))) if strip: return [t.strip() for t in text.split(",") if t.strip()] @@ -45,9 +44,9 @@ def binary_encode(text, encoding="utf-8"): Does nothing if text not unicode string. """ - if isinstance(text, six.binary_type): + if isinstance(text, bytes): return text - elif isinstance(text, six.text_type): + elif isinstance(text, str): return text.encode(encoding) else: raise TypeError("Expected binary or string type") @@ -58,9 +57,9 @@ def binary_decode(data, encoding="utf-8"): Does nothing if data is already unicode string. """ - if isinstance(data, six.binary_type): + if isinstance(data, bytes): return data.decode(encoding) - elif isinstance(data, six.text_type): + elif isinstance(data, str): return data else: raise TypeError("Expected binary or string type") @@ -154,7 +153,7 @@ def import_modules_from_package(package): def shorten_id(span_id): """Convert from uuid4 to 64 bit id for OpenTracing""" int64_max = (1 << 64) - 1 - if isinstance(span_id, six.integer_types): + if isinstance(span_id, int): return span_id & int64_max try: short_id = uuid.UUID(span_id).int & int64_max |