Skip to content

Commit

Permalink
Remove unnecessary use of six.binary_type (html5lib#400)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jdufresne authored and gsnedders committed Oct 1, 2018
1 parent 7facf98 commit fd04f6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions html5lib/_inputstream.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fd04f6a

Please sign in to comment.