B ÍAÒ[W?ã@sXdZddlZe d¡jZe d¡jZe d¡Ze d¡Ze d¡Z[Gdd „d e ƒZ dS) aShared support for scanning document type declarations in HTML and XHTML. Backported for python-future from Python 3.3. Reason: ParserBase is an old-style class in the Python 2.7 source of markupbase.py, which I suspect might be the cause of sporadic unit-test failures on travis-ci.org with test_htmlparser.py. The test failures look like this: ====================================================================== ERROR: test_attr_entity_replacement (future.tests.test_htmlparser.AttributesStrictTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 661, in test_attr_entity_replacement [("starttag", "a", [("b", "&><"'")])]) File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 93, in _run_check collector = self.get_collector() File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 617, in get_collector return EventCollector(strict=True) File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 27, in __init__ html.parser.HTMLParser.__init__(self, *args, **kw) File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 135, in __init__ self.reset() File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 143, in reset _markupbase.ParserBase.reset(self) TypeError: unbound method reset() must be called with ParserBase instance as first argument (got EventCollector instance instead) This module is used as a foundation for the html.parser module. It has no documented public API and should not be used directly. éNz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z ]\s*]\s*>z]\s*>c@seZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd Z d d„Z d#dd„Z d$dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"S)%Ú ParserBaseziParser base class which provides some common support methods used by the SGML/HTML and XHTML parsers.cCs|jtkrtdƒ‚dS)Nz)_markupbase.ParserBase must be subclassed)Ú __class__rÚ RuntimeError)Úself©rúM/opt/alt/python37/lib/python3.7/site-packages/future/backports/_markupbase.pyÚ__init__6s zParserBase.__init__cCs tdƒ‚dS)Nz.subclasses of ParserBase must override error())ÚNotImplementedError)rÚmessagerrrÚerror;szParserBase.errorcCsd|_d|_dS)Nér)ÚlinenoÚoffset)rrrrÚreset?szParserBase.resetcCs |j|jfS)z&Return current line number and offset.)r r)rrrrÚgetposCszParserBase.getposcCsb||kr |S|j}| d||¡}|rN|j||_| d||¡}||d|_n|j|||_|S)NÚ r )ÚrawdataÚcountr Úrindexr)rÚiÚjrZnlinesÚposrrrÚ updateposKs zParserBase.updateposÚc Csð|j}|d}|||…dks&tdƒ‚|||d…dkrB|dS|||d…dkrZdSt|ƒ}|||d…dkr€| |¡S||d kr–| |¡S| ||¡\}}|d kr²|S|d krÀd |_x(||krê||}|dkr||d|…}|d kr| |¡n | |¡|dS|d kr@t ||ƒ}|s6dS|  ¡}nœ|dkr\| ||¡\} }n€||jkrr|d}nj|d krÊ|d kr˜|  |d|¡}n0|t ddddgƒkr¾|  d|¡n |  d¡n|  d||¡|d krÄ|SqÄWdS)Néz)ú-réÿÿÿÿz--ú[rZdoctyperz"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZÚattlistZlinktypeÚlinkÚelementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)rÚAssertionErrorÚlenÚ parse_commentÚparse_marked_sectionÚ _scan_nameÚ_decl_othercharsZ handle_declÚ unknown_declÚ_declstringlit_matchÚendÚ_parse_doctype_subsetÚsetr ) rrrrÚnZdecltypeÚcÚdataÚmÚnamerrrÚparse_declaration[sZ                 zParserBase.parse_declarationr cCsÞ|j}|||d…dks"tdƒ‚| |d|¡\}}|dkrB|S|tddddd gƒkrjt ||d¡}n>|td d d gƒkrŽt ||d¡}n| d ||d|…¡|s°dS|rÔ| d¡}|  ||d|…¡|  d¡S)Nézr7r9ÚobjectrrrrrÚ!s