diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-09-14 06:12:40 -0700 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-09-24 12:25:39 -0400 |
commit | ccb206826cd1784990f874eb81073f05d720b48b (patch) | |
tree | c14b3c1c9a345195227cfa8ae7de087126a33b41 | |
parent | d4ce2386a0d6385937c819537f9f88d6884afbf4 (diff) | |
download | dateutil-ccb206826cd1784990f874eb81073f05d720b48b.tar.gz |
Remove unnecessary binary_type compatibility shim
The bytes type is available on all supported Pythons. Can remove
workaround and make the code more forward compatible with Python 3.
-rw-r--r-- | dateutil/parser/_parser.py | 4 | ||||
-rw-r--r-- | dateutil/test/test_isoparser.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/dateutil/parser/_parser.py b/dateutil/parser/_parser.py index 9d2bb79..044466d 100644 --- a/dateutil/parser/_parser.py +++ b/dateutil/parser/_parser.py @@ -40,7 +40,7 @@ from calendar import monthrange from io import StringIO import six -from six import binary_type, integer_types, text_type +from six import integer_types, text_type from decimal import Decimal @@ -63,7 +63,7 @@ class _timelex(object): if six.PY2: # In Python 2, we can't duck type properly because unicode has # a 'decode' function, and we'd be double-decoding - if isinstance(instream, (binary_type, bytearray)): + if isinstance(instream, (bytes, bytearray)): instream = instream.decode() else: if getattr(instream, 'decode', None) is not None: diff --git a/dateutil/test/test_isoparser.py b/dateutil/test/test_isoparser.py index e60b0b0..b0e6564 100644 --- a/dateutil/test/test_isoparser.py +++ b/dateutil/test/test_isoparser.py @@ -380,7 +380,7 @@ def test_parse_isodate(d, dt_fmt, as_bytes): d_str = d.strftime(dt_fmt) if isinstance(d_str, six.text_type) and as_bytes: d_str = d_str.encode('ascii') - elif isinstance(d_str, six.binary_type) and not as_bytes: + elif isinstance(d_str, bytes) and not as_bytes: d_str = d_str.decode('ascii') iparser = isoparser() @@ -454,7 +454,7 @@ def test_isotime(time_val, time_fmt, as_bytes): tstr = time_val.strftime(time_fmt) if isinstance(time_val, six.text_type) and as_bytes: tstr = tstr.encode('ascii') - elif isinstance(time_val, six.binary_type) and not as_bytes: + elif isinstance(time_val, bytes) and not as_bytes: tstr = tstr.decode('ascii') iparser = isoparser() |