1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Convert to six.py.

This avoids some clutter.
This commit is contained in:
Shlomi Fish 2018-02-19 17:35:21 +02:00
parent e27cbb4c96
commit 00e2388753

View file

@ -4,12 +4,7 @@ See the HTML 2.0 specification:
http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html
""" """
try: from six.moves import html_parser
import html.parser as htmllib
except ImportError:
# For Python 2 tests compatibility
import HTMLParser as htmllib
from formatter import AS_IS from formatter import AS_IS
__all__ = ["HTMLParser", "HTMLParseError"] __all__ = ["HTMLParser", "HTMLParseError"]
@ -19,7 +14,7 @@ class HTMLParseError(RuntimeError):
"""Error raised when an HTML document can't be parsed.""" """Error raised when an HTML document can't be parsed."""
class HTMLParser(htmllib.HTMLParser): class HTMLParser(html_parser.HTMLParser):
"""This is the basic HTML parser class. """This is the basic HTML parser class.
It supports all entity names required by the XHTML 1.0 Recommendation. It supports all entity names required by the XHTML 1.0 Recommendation.
@ -37,14 +32,14 @@ class HTMLParser(htmllib.HTMLParser):
the parser. the parser.
""" """
htmllib.HTMLParser.__init__(self) html_parser.HTMLParser.__init__(self)
self.formatter = formatter self.formatter = formatter
def error(self, message): def error(self, message):
raise HTMLParseError(message) raise HTMLParseError(message)
def reset(self): def reset(self):
htmllib.HTMLParser.reset(self) html_parser.HTMLParser.reset(self)
self.savedata = None self.savedata = None
self.isindex = 0 self.isindex = 0
self.title = None self.title = None