From 43091dfed50b1e733a79c862f2680517c7d3c842 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Fri, 14 Sep 2018 05:49:20 -0700 Subject: [PATCH] Remove unnecessary compatibility shim for BytesIO io.BytesIO is available on all supported Pythons. Can simplify by assuming the import will succeed. --- html5lib/_inputstream.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/html5lib/_inputstream.py b/html5lib/_inputstream.py index c20e94fd..1635a208 100644 --- a/html5lib/_inputstream.py +++ b/html5lib/_inputstream.py @@ -5,6 +5,7 @@ import codecs import re +from io import BytesIO, StringIO import webencodings @@ -12,13 +13,6 @@ from .constants import _ReparseException from . import _utils -from io import StringIO - -try: - from io import BytesIO -except ImportError: - BytesIO = StringIO - # Non-unicode versions of constants for use in the pre-parser spaceCharactersBytes = frozenset([item.encode("ascii") for item in spaceCharacters]) asciiLettersBytes = frozenset([item.encode("ascii") for item in asciiLetters])