summaryrefslogtreecommitdiff
path: root/logilab
diff options
context:
space:
mode:
authorNicola Spanti <nicola.spanti@logilab.fr>2019-11-19 11:45:20 +0100
committerNicola Spanti <nicola.spanti@logilab.fr>2019-11-19 11:45:20 +0100
commit1fd09033a846d2dddfea78b2a413d243d330f283 (patch)
treee8a4ccb76ff64d3973ad7c9e8a2048522242be91 /logilab
parent6145fc34878e1a741361e08304e7f364979df7b5 (diff)
downloadlogilab-common-1fd09033a846d2dddfea78b2a413d243d330f283.tar.gz
Drop dependency on six
Diffstat (limited to 'logilab')
-rw-r--r--logilab/common/compat.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/logilab/common/compat.py b/logilab/common/compat.py
index f2eb590..eee0a61 100644
--- a/logilab/common/compat.py
+++ b/logilab/common/compat.py
@@ -35,21 +35,14 @@ import types
from warnings import warn
# not used here, but imported to preserve API
-from six.moves import builtins
+import builtins
-if sys.version_info < (3, 0):
- str_to_bytes = str
- def str_encode(string, encoding):
- if isinstance(string, unicode):
- return string.encode(encoding)
- return str(string)
-else:
- def str_to_bytes(string):
- return str.encode(string)
- # we have to ignore the encoding in py3k to be able to write a string into a
- # TextIOWrapper or like object (which expect an unicode string)
- def str_encode(string, encoding):
- return str(string)
+def str_to_bytes(string):
+ return str.encode(string)
+# we have to ignore the encoding in py3k to be able to write a string into a
+# TextIOWrapper or like object (which expect an unicode string)
+def str_encode(string, encoding):
+ return str(string)
# See also http://bugs.python.org/issue11776
if sys.version_info[0] == 3: