From 609b553d3dd425112dc78832cf0763e672963a15 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 22 Nov 2017 14:22:18 +0200 Subject: [PATCH] Remove redundant <=2.6 code --- html5lib/_utils.py | 5 +---- html5lib/html5parser.py | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) 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()) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy