Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd4f239

Browse files
committed
Clean up the constants imports in html5parser
1 parent 7491e00 commit cd4f239

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

html5lib/html5parser.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
from .treebuilders._base import Marker
1111

1212
from . import utils
13-
from . import constants
14-
from .constants import spaceCharacters, asciiUpper2Lower
15-
from .constants import specialElements
16-
from .constants import headingElements
17-
from .constants import cdataElements, rcdataElements
18-
from .constants import tokenTypes, ReparseException, namespaces
19-
from .constants import htmlIntegrationPointElements, mathmlTextIntegrationPointElements
20-
from .constants import adjustForeignAttributes as adjustForeignAttributesMap
21-
from .constants import E
13+
from .constants import (
14+
spaceCharacters, asciiUpper2Lower,
15+
specialElements, headingElements, cdataElements, rcdataElements,
16+
tokenTypes, tagTokenTypes,
17+
namespaces,
18+
htmlIntegrationPointElements, mathmlTextIntegrationPointElements,
19+
adjustForeignAttributes as adjustForeignAttributesMap,
20+
E,
21+
ReparseException
22+
)
2223

2324

2425
def parse(doc, treebuilder="etree", encoding=None,
@@ -422,7 +423,7 @@ def getPhases(debug):
422423
def log(function):
423424
"""Logger that records which phase processes each token"""
424425
type_names = dict((value, key) for key, value in
425-
constants.tokenTypes.items())
426+
tokenTypes.items())
426427

427428
def wrapped(self, *args, **kwargs):
428429
if function.__name__.startswith("process") and len(args) > 0:
@@ -431,7 +432,7 @@ def wrapped(self, *args, **kwargs):
431432
info = {"type": type_names[token['type']]}
432433
except:
433434
raise
434-
if token['type'] in constants.tagTokenTypes:
435+
if token['type'] in tagTokenTypes:
435436
info["name"] = token['name']
436437

437438
self.parser.log.append((self.parser.tokenizer.state.__name__,

0 commit comments

Comments
 (0)