From ae285be3a81e6c05d669c8054a80d1553e1ebe92 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Fri, 14 Sep 2018 06:03:30 -0700 Subject: [PATCH] Remove unnecessary use of six.binary_type The bytes type is available on all support Pythons. On Python 2 it is an alias of str (same as six). Reduce unnecessary compatibility shims and by using modern Python idioms. Makes the code more forward compatible with Python 3. --- html5lib/_inputstream.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html5lib/_inputstream.py b/html5lib/_inputstream.py index c20e94fd..62f5e9d5 100644 --- a/html5lib/_inputstream.py +++ b/html5lib/_inputstream.py @@ -1,6 +1,6 @@ from __future__ import absolute_import, division, unicode_literals -from six import text_type, binary_type +from six import text_type from six.moves import http_client, urllib import codecs @@ -908,7 +908,7 @@ def parse(self): def lookupEncoding(encoding): """Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.""" - if isinstance(encoding, binary_type): + if isinstance(encoding, bytes): try: encoding = encoding.decode("ascii") except UnicodeDecodeError: