summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-10-10 20:34:09 -0700
committerAarni Koskela <akx@iki.fi>2019-01-25 00:19:37 +0200
commite4d834d4c1bffe05e71ee2ec21449b6b0b115e99 (patch)
treef0fe40dc14a7a8401d4b468a657622a9e85a5989
parentcece931c2fef3a612e5c7da9baccf4eed41b3647 (diff)
downloadbabel-e4d834d4c1bffe05e71ee2ec21449b6b0b115e99.tar.gz
Remove unnecessary compat shim 'binary_type'
The bytes type is available on all supported Pythons. On Python 2, it is an alias of str, same as binary_type. By removing the shim, makes the code more forward compatible.
-rw-r--r--babel/_compat.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/babel/_compat.py b/babel/_compat.py
index 849f749..11b4d7a 100644
--- a/babel/_compat.py
+++ b/babel/_compat.py
@@ -8,7 +8,6 @@ _identity = lambda x: x
if not PY2:
text_type = str
- binary_type = bytes
string_types = (str,)
integer_types = (int, )
@@ -33,7 +32,6 @@ if not PY2:
else:
text_type = unicode
- binary_type = str
string_types = (str, unicode)
integer_types = (int, long)
@@ -63,7 +61,7 @@ number_types = integer_types + (float,)
def force_text(s, encoding='utf-8', errors='strict'):
if isinstance(s, text_type):
return s
- if isinstance(s, binary_type):
+ if isinstance(s, bytes):
return s.decode(encoding, errors)
return text_type(s)