HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //usr/local/lib/python3.9/site-packages/future/backports/__pycache__/_markupbase.cpython-39.pyc
a

q�dgW?�@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@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdZ	d
d�Z
d#dd�Zd$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|jturtd��dS)Nz)_markupbase.ParserBase must be subclassed)�	__class__r�RuntimeError��self�r�F/usr/local/lib/python3.9/site-packages/future/backports/_markupbase.py�__init__6s
�zParserBase.__init__cCstd��dS)Nz.subclasses of ParserBase must override error())�NotImplementedError)r�messagerrr�error;s�zParserBase.errorcCsd|_d|_dS)N�r��lineno�offsetrrrr�reset?szParserBase.resetcCs|j|jfS)z&Return current line number and offset.rrrrr�getposCszParserBase.getposcCsb||kr|S|j}|�d||�}|rN|j||_|�d||�}||d|_n|j|||_|S)N�
r
)�rawdata�countr�rindexr)r�i�jr�nlines�posrrr�	updateposKszParserBase.updatepos�c
Cs�|j}|d}|||�dks&Jd��|||d�dkrB|dS|||d�dvrZdSt|�}|||d�dkr�|�|�S||d	kr�|�|�S|�||�\}}|d
kr�|S|dkr�d|_||k�r�||}|dk�r||d|�}|dk�r|�|�n
|�|�|dS|d
v�r<t||�}|�s2dS|�	�}n�|dv�rX|�||�\}	}n|||jv�rn|d}nf|d	k�r�|dk�r�|�
|d|�}n,|tgd��v�r�|�d|�n
|�d�n|�d||�|d
kr�|Sq�dS)N��<!z$unexpected call to parse_declarationr
�>)�-r���z--�[r�doctyperz"'�4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)�attlist�linktype�link�elementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)
r�len�
parse_comment�parse_marked_section�
_scan_name�_decl_otherchars�handle_decl�unknown_decl�_declstringlit_match�end�_parse_doctype_subset�setr)
rrrr�n�decltype�c�data�m�namerrr�parse_declaration[s\













�zParserBase.parse_declarationr
cCs�|j}|||d�dks"Jd��|�|d|�\}}|dkrB|S|tgd��vrdt�||d�}n<|tgd��vr�t�||d�}n|�d||d|��|s�dS|r�|�d�}|�||d|��|�	d�S)	N�z<![z)unexpected call to parse_marked_section()r)�temp�cdata�ignore�include�rcdata)�if�else�endifz+unknown status keyword %r in marked sectionr!)
rr,r3�_markedsectionclose�search�_msmarkedsectioncloser�startr/r1)rr�reportr�sectNamer�matchrrrr+�s 
zParserBase.parse_marked_sectioncCsj|j}|||d�dkr$|�d�t�||d�}|s<dS|r`|�d�}|�||d|��|�d�S)N��<!--z"unexpected call to parse_comment()r!r)rr�
_commentcloserErG�handle_commentr1)rrrHrrJrrrrr*�s

zParserBase.parse_commentc
Cs2|j}t|�}|}||k�r.||}|dk�r8|||d�}|dkrJdS|dkrp|�||d�|�d|�|d|kr�dS|d|kr�dS|||d�dkr�|j|d	d
�}|d	kr|Sq|�|d|�\}}|dkr�dS|tgd��v�r|�||d�|�d|�t|d
|�}	|	||�}|d	k�r,|Sq|dk�r�|d|k�rTdS|�|d|�\}}|d	k�rv|S||dk�r,|d}q|dk�r�|d}||k�r�||���r�|d}�q�||k�r�||dk�r�|S|�||�|�d�ndSq|���r|d}q|�||�|�d|�qdS)N�<rr!rr
z*unexpected char in internal subset (in %r)rKrLr)rH)r%r(�entity�notationz)unknown declaration %r in internal subset�_parse_doctype_�%�;�]rz%unexpected char after internal subsetz%unexpected char %r in internal subset)	rr)rrr*r,r3�getattr�isspace)
rr�declstartposrr4rr6�sr9�methrrrr2�sp

�








z ParserBase._parse_doctype_subsetcCsF|�||�\}}|dkrdS|j}d||d�vrB|�d|�dSdS)Nr!rr
)r,r�find)rrrXr9rrrrr�_parse_doctype_elementsz!ParserBase._parse_doctype_elementcCs�|j}|�||�\}}|||d�}|dkr2dS|dkrB|dS|�||�\}}|dkr^|S|||d�}|dkrzdS|dkr�d||d�vr�|�d|�d}ndS|||d���r�|d}q�||d�s�dSn|�||�\}}|||d�}|�sdS|dv�rDt||�}|�r&|��}ndS|||d�}|�sDdS|d	k�r�||d�d	k�rddS|�|d|�\}}|dk�r�|S|||d�}|�s�dS|dkrB|dSqBdS)
Nr
rr!rr�(�)�'"�#)rr,r[rWr0r1)rrrXrr9rr6r8rrr�_parse_doctype_attlistsX





z!ParserBase._parse_doctype_attlistcCs�|�||�\}}|dkr|S|j}|||d�}|s:dS|dkrJ|dS|dvrnt||�}|sddS|��}q"|�||�\}}|dkr"|Sq"dS)Nrr
r!rr_)r,rr0r1)rrrXr9rrr6r8rrr�_parse_doctype_notationXs"

z"ParserBase._parse_doctype_notationcCs�|j}|||d�dkrR|d}|||d�}|s:dS|��rP|d}q"qVq"n|}|�||�\}}|dkrr|S|j||d�}|s�dS|dvr�t||�}|r�|��}q�dSqr|dkr�|dS|�||�\}}|dkrr|SqrdS)Nr
rSr!rr_r)rrWr,r0r1)rrrXrrr6r9r8rrr�_parse_doctype_entityos4


z ParserBase._parse_doctype_entitycCs�|j}t|�}||krdSt||�}|r\|��}|��}|t|�|krLdS|��|��fS|�||�|�d|||d��dS)N)Nr!zexpected name token at %r�)	rr)�_declname_match�group�strip�lowerr1rr)rrrXrr4r8rYr9rrrr,�s
�zParserBase._scan_namecCsdS)Nr)rr7rrrr/�szParserBase.unknown_declN)r
)r
)�__name__�
__module__�__qualname__�__doc__r	rrrrr-r:r+r*r2r\rarbrcr,r/rrrrr2s"
R

C9$r)rl�re�compilerJrer0rMrDrF�objectrrrrr�<module>s"