Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Remove redundant <=2.6 code #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions html5lib/_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import absolute_import, division, unicode_literals

import sys
from types import ModuleType

from six import text_type
Expand All @@ -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
Expand Down
7 changes: 2 additions & 5 deletions html5lib/html5parser.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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())
Expand Down