|
1 | 1 | from __future__ import absolute_import, division, unicode_literals |
2 | 2 | from six import with_metaclass |
3 | 3 |
|
4 | | -import sys |
5 | 4 | import types |
6 | 5 |
|
7 | 6 | from . import inputstream |
|
14 | 13 | from . import utils |
15 | 14 | from . import constants |
16 | 15 | from .constants import spaceCharacters, asciiUpper2Lower |
17 | | -from .constants import formattingElements, specialElements |
18 | | -from .constants import headingElements, tableInsertModeElements |
19 | | -from .constants import cdataElements, rcdataElements, voidElements |
20 | | -from .constants import tokenTypes, ReparseException, namespaces, spaceCharacters |
| 16 | +from .constants import specialElements |
| 17 | +from .constants import headingElements |
| 18 | +from .constants import cdataElements, rcdataElements |
| 19 | +from .constants import tokenTypes, ReparseException, namespaces |
21 | 20 | from .constants import htmlIntegrationPointElements, mathmlTextIntegrationPointElements |
22 | 21 |
|
23 | 22 | def parse(doc, treebuilder="simpletree", encoding=None, |
@@ -88,7 +87,7 @@ def _parse(self, stream, innerHTML=False, container="div", |
88 | 87 | try: |
89 | 88 | self.mainLoop() |
90 | 89 | break |
91 | | - except ReparseException as e: |
| 90 | + except ReparseException: |
92 | 91 | self.reset() |
93 | 92 |
|
94 | 93 | def reset(self): |
@@ -405,7 +404,7 @@ def parseRCDataRawtext(self, token, contentType): |
405 | 404 | """ |
406 | 405 | assert contentType in ("RAWTEXT", "RCDATA") |
407 | 406 |
|
408 | | - element = self.tree.insertElement(token) |
| 407 | + self.tree.insertElement(token) |
409 | 408 |
|
410 | 409 | if contentType == "RAWTEXT": |
411 | 410 | self.tokenizer.state = self.tokenizer.rawtextState |
@@ -1402,7 +1401,6 @@ def endTagFormatting(self, token): |
1402 | 1401 | """The much-feared adoption agency algorithm""" |
1403 | 1402 | # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency |
1404 | 1403 | # XXX Better parseError messages appreciated. |
1405 | | - name = token["name"] |
1406 | 1404 |
|
1407 | 1405 | # Step 1 |
1408 | 1406 | outerLoopCounter = 0 |
@@ -1620,7 +1618,7 @@ def endTagScript(self, token): |
1620 | 1618 | #document.write works |
1621 | 1619 |
|
1622 | 1620 | def endTagOther(self, token): |
1623 | | - node = self.tree.openElements.pop() |
| 1621 | + self.tree.openElements.pop() |
1624 | 1622 | self.parser.phase = self.parser.originalPhase |
1625 | 1623 |
|
1626 | 1624 | class InTablePhase(Phase): |
|
0 commit comments