diff --git a/html5lib/_utils.py b/html5lib/_utils.py index 03f0dab7..91252f2c 100644 --- a/html5lib/_utils.py +++ b/html5lib/_utils.py @@ -1,6 +1,5 @@ from __future__ import absolute_import, division, unicode_literals -import sys from types import ModuleType from six import text_type @@ -13,11 +12,9 @@ __all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair", "surrogatePairToCodepoint", "moduleFactoryFactory", - "supports_lone_surrogates", "PY27"] + "supports_lone_surrogates"] -PY27 = sys.version_info[0] == 2 and sys.version_info[1] >= 7 - # Platforms not supporting lone surrogates (\uD800-\uDFFF) should be # caught by the below test. In general this would be any platform # using UTF-16 as its encoding of unicode strings, such as diff --git a/html5lib/html5parser.py b/html5lib/html5parser.py index f8309e14..dd8ba6f7 100644 --- a/html5lib/html5parser.py +++ b/html5lib/html5parser.py @@ -1,5 +1,5 @@ from __future__ import absolute_import, division, unicode_literals -from six import with_metaclass, viewkeys, PY3 +from six import with_metaclass, viewkeys import types from collections import OrderedDict @@ -2707,10 +2707,7 @@ def processEndTag(self, token): def adjust_attributes(token, replacements): - if PY3 or _utils.PY27: - needs_adjustment = viewkeys(token['data']) & viewkeys(replacements) - else: - needs_adjustment = frozenset(token['data']) & frozenset(replacements) + needs_adjustment = viewkeys(token['data']) & viewkeys(replacements) if needs_adjustment: token['data'] = OrderedDict((replacements.get(k, k), v) for k, v in token['data'].items())