Skip to content

Commit 6f8320e

Browse files
hugovkgsnedders
authored andcommitted
Remove redundant <=2.6 code (#362)
1 parent 2afc3ad commit 6f8320e

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

html5lib/_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import absolute_import, division, unicode_literals
22

3-
import sys
43
from types import ModuleType
54

65
from six import text_type
@@ -13,11 +12,9 @@
1312

1413
__all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair",
1514
"surrogatePairToCodepoint", "moduleFactoryFactory",
16-
"supports_lone_surrogates", "PY27"]
15+
"supports_lone_surrogates"]
1716

1817

19-
PY27 = sys.version_info[0] == 2 and sys.version_info[1] >= 7
20-
2118
# Platforms not supporting lone surrogates (\uD800-\uDFFF) should be
2219
# caught by the below test. In general this would be any platform
2320
# using UTF-16 as its encoding of unicode strings, such as

html5lib/html5parser.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import absolute_import, division, unicode_literals
2-
from six import with_metaclass, viewkeys, PY3
2+
from six import with_metaclass, viewkeys
33

44
import types
55
from collections import OrderedDict
@@ -2707,10 +2707,7 @@ def processEndTag(self, token):
27072707

27082708

27092709
def adjust_attributes(token, replacements):
2710-
if PY3 or _utils.PY27:
2711-
needs_adjustment = viewkeys(token['data']) & viewkeys(replacements)
2712-
else:
2713-
needs_adjustment = frozenset(token['data']) & frozenset(replacements)
2710+
needs_adjustment = viewkeys(token['data']) & viewkeys(replacements)
27142711
if needs_adjustment:
27152712
token['data'] = OrderedDict((replacements.get(k, k), v)
27162713
for k, v in token['data'].items())

0 commit comments

Comments
 (0)