P~? d Z ddlZ ej d j Z ej d j Z ej d Z ej d Z ej d Z[ G d d e Z dS ) a Shared 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 t e Zd ZdZd Zd Zd Zd Zd ZdZ d Z dd ZddZd Z d Zd Zd Zd Zd Zd ZdS ) ParserBaseziParser base class which provides some common support methods used by the SGML/HTML and XHTML parsers.c @ | j t u rt d d S )Nz)_markupbase.ParserBase must be subclassed) __class__r RuntimeErrorselfs n/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/future/backports/_markupbase.py__init__zParserBase.__init__6 s, >Z'';= = = (' c t d )Nz.subclasses of ParserBase must override error())NotImplementedError)r messages r errorzParserBase.error; s !<> > >r c " d| _ d| _ d S )N r linenooffsetr s r resetzParserBase.reset? s r c | j | j fS )z&Return current line number and offset.r r s r getposzParserBase.getposC s {DK''r c ||k r|S | j }| d|| }|r4| j |z | _ | d|| }||dz z | _ n| j |z |z | _ |S )N r )rawdatacountr rindexr )r ijr nlinesposs r updateposzParserBase.updateposK s 66H,tQ** ,+.DK..q!,,CSU)DKK+/!+DKr c 2 | j }|dz }||| dk s J d |||dz dk r|dz S |||dz dv rdS t | }|||dz dk r| | S || d k r| | S | || \ }}|d k r|S |dk rd| _ ||k r@|| }|dk rC||dz | }|dk r| | n| | |dz S |d v r)t || }|sdS | }n|dv r| || \ } }n|| j v r|dz }n|d k rb|dk r| |dz | }n`|t g d v r| d|z n4| d n| d|| z |d k r|S ||k @dS )N