Your IP : 18.191.120.103


Current Path : /opt/alt/python312/lib64/python3.12/html/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/html/__pycache__/parser.cpython-312.opt-1.pyc

�

�Q�f�B���dZddlZddlZddlmZdgZejd�Zejd�Zejd�Z	ejd�Z
ejd	�Zejd
�Zejd�Z
ejd�Zejd
�Zejdej �Zejd
�Zejd�ZGd�dej(�Zy)zA parser for HTML and XHTML.�N)�unescape�
HTMLParserz[&<]z
&[a-zA-Z#]z%&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]z)&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]z	<[a-zA-Z]�>z--\s*>z+([a-zA-Z][^\t\n\r\f />\x00]*)(?:\s|/(?!>))*z]((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*aF
  <[a-zA-Z][^\t\n\r\f />\x00]*       # tag name
  (?:[\s/]*                          # optional whitespace before attribute name
    (?:(?<=['"\s/])[^\s/>][^\s/=>]*  # attribute name
      (?:\s*=+\s*                    # value indicator
        (?:'[^']*'                   # LITA-enclosed value
          |"[^"]*"                   # LIT-enclosed value
          |(?!['"])[^>\s]*           # bare value
         )
        \s*                          # possibly followed by a space
       )?(?:\s|/(?!>))*
     )*
   )?
  \s*                                # trailing whitespace
z#</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>c���eZdZdZdZdd��fd�
Z�fd�Zd�Zd�Zd	Z	d
�Z
d�Zd�Zd
�Z
d�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z�xZS)raEFind tags and other markup and call handler functions.

    Usage:
        p = HTMLParser()
        p.feed(data)
        ...
        p.close()

    Start tags are handled by calling self.handle_starttag() or
    self.handle_startendtag(); end tags by self.handle_endtag().  The
    data between tags is passed from the parser to the derived class
    by calling self.handle_data() with the data as argument (the data
    may be split up in arbitrary chunks).  If convert_charrefs is
    True the character references are converted automatically to the
    corresponding Unicode character (and self.handle_data() is no
    longer split in chunks), otherwise they are passed by calling
    self.handle_entityref() or self.handle_charref() with the string
    containing respectively the named or numeric reference as the
    argument.
    )�script�styleT)�convert_charrefsc�P��t�|��||_|j�y)z�Initialize and reset this instance.

        If convert_charrefs is True (the default), all character references
        are automatically converted to the corresponding Unicode characters.
        N)�super�__init__r	�reset)�selfr	�	__class__s  ��2/opt/alt/python312/lib64/python3.12/html/parser.pyrzHTMLParser.__init__Vs!���	���� 0����
�
��c�b��d|_d|_t|_d|_t
�|��y)z1Reset this instance.  Loses all unprocessed data.�z???N)�rawdata�lasttag�interesting_normal�interesting�
cdata_elemrr
)rrs �rr
zHTMLParser.reset`s)���������-������
��
�rc�N�|j|z|_|jd�y)z�Feed data to the parser.

        Call this as often as you want, with as little or as much text
        as you want (may include '\n').
        rN)r�goahead�r�datas  r�feedzHTMLParser.feedhs���|�|�d�*������Q�rc�&�|jd�y)zHandle any buffered data.�N)r�rs r�closezHTMLParser.closeqs
�����Q�rNc��|jS)z)Return full source of start tag: '<...>'.)�_HTMLParser__starttag_textr s r�get_starttag_textzHTMLParser.get_starttag_textws���#�#�#rc��|j�|_tjd|jztj�|_y)Nz</\s*%s\s*>)�lowerr�re�compile�Ir)r�elems  r�set_cdata_modezHTMLParser.set_cdata_mode{s/���*�*�,����:�:�n�t���&F����M��rc�(�t|_d|_y�N)rrrr s r�clear_cdata_modezHTMLParser.clear_cdata_modes��-�����rc��	�|j}d}t|�}||k�rP|jrq|jse|j	d|�}|dkr�|jdt
||dz
��}|dk\r'tjd�j||�s�n�|}n?|jj||�}|r|j�}n|jr�n�|}||krJ|jr*|js|jt|||��n|j|||�|j||�}||k(r�n,|j}|d|��r[t j#||�r|j%|�}	n�|d|�r|j'|�}	nr|d|�r|j)|�}	nW|d|�r|j+|�}	n<|d	|�r|j-|�}	n!|d
z|kr|jd�|d
z}	n�na|	dkr�|s�nX|j	d|d
z�}	|	dkr |j	d|d
z�}	|	dkr|d
z}	n|	d
z
}	|jr*|js|jt|||	��n|j|||	�|j||	�}�n�|d|�r�t.j#||�}|rY|j1�d
d}
|j3|
�|j5�}	|d|	d
z
�s|	d
z
}	|j||	�}��d||dvr,|j|||d
z�|j||d
z�}�n|d|�r�t6j#||�}|rW|j1d
�}
|j9|
�|j5�}	|d|	d
z
�s|	d
z
}	|j||	�}���t:j#||�}|rE|rB|j1�||dk(r,|j5�}	|	|kr|}	|j||d
z�}n7|d
z|kr'|jd�|j||d
z�}nn||kr��P|rm||krh|js\|jr*|js|jt|||��n|j|||�|j||�}||d|_y)Nr�<�&�"z[\s;]z</�<!--z<?z<!rrz&#�����;)r�lenr	r�find�rfind�maxr'r(�searchr�start�handle_datar�	updatepos�
startswith�starttagopen�match�parse_starttag�parse_endtag�
parse_comment�parse_pi�parse_html_declaration�charref�group�handle_charref�end�	entityref�handle_entityref�
incomplete)rrJr�i�n�j�ampposrAr?�k�names           rrzHTMLParser.goahead�s����,�,��
����L���!�e��$�$�T�_�_��L�L��a�(���q�5�%�]�]�3��A�q��t��=�F��!���J�J�x�0�7�7���H���A��(�(�/�/���;������
�A������A��1�u��(�(�����$�$�X�g�a��l�%;�<��$�$�W�Q�q�\�2����q�!�$�A��A�v�u� �+�+�J��#�q�!��%�%�g�q�1��+�+�A�.�A���a�(��)�)�!�,�A����*��*�*�1�-�A���a�(��
�
�a�(�A���a�(��3�3�A�6�A��!�e�q�[��$�$�S�)��A��A���q�5������S�!�a�%�0�A��1�u�#�L�L��a�!�e�4���q�5� !�A��A��Q����,�,�T�_�_��(�(��'�!�A�,�)?�@��(�(���1��6��N�N�1�a�(���D�!�$��
�
�g�q�1��� �;�;�=��2�.�D��'�'��-��	�	��A�%�c�1�Q�3�/���E�����q�!�,�A���g�a�b�k�)��(�(���1�Q�3��8� �N�N�1�a��c�2����C��#�!�����3��� �;�;�q�>�D��)�)�$�/��	�	��A�%�c�1�Q�3�/���E�����q�!�,�A��"�(�(��!�4����u�{�{�}�����;�!�I�I�K����6� !�A� �N�N�1�a�!�e�4����!�e�q�[��$�$�S�)����q�!�a�%�0�A��O�!�e�V�1�q�5�����$�$�T�_�_�� � ��'�!�A�,�!7�8�� � ���1��.����q�!�$�A��q�r�{��rc�L�|j}|||dzdk(r|j|�S|||dzdk(r|j|�S|||dzj�dk(r7|j	d|dz�}|dk(ry|j||d	z|�|d
zS|j
|�S)N�r3�z<![�	z	<!doctyperr5r4r)rrD�parse_marked_sectionr&r8�handle_decl�parse_bogus_comment)rrNr�gtposs    rrFz!HTMLParser.parse_html_declarations����,�,���1�Q�q�S�>�V�#��%�%�a�(�(�
�Q�q��s�^�u�
$��,�,�Q�/�/�
�Q�q��s�^�
!�
!�
#�{�
2��L�L��a��c�*�E���{�����W�Q�q�S��/�0���7�N��+�+�A�.�.rc��|j}|jd|dz�}|dk(ry|r|j||dz|�|dzS)Nrr4r5r)rr8�handle_comment)rrN�reportr�poss     rrZzHTMLParser.parse_bogus_commentsP���,�,���l�l�3��!��$���"�9��������!��C� 0�1��Q�w�rc���|j}tj||dz�}|sy|j�}|j	||dz|�|j�}|S)Nr4r5)r�picloser;r<�	handle_pirJ)rrNrrArPs     rrEzHTMLParser.parse_pi!sV���,�,�����w��!��,�����K�K�M�����w�q��s�A��'��I�I�K���rc�l�d|_|j|�}|dkr|S|j}||||_g}tj	||dz�}|j�}|j
d�j�x|_}||kr�tj	||�}|sn�|j
ddd�\}	}
}|
sd}n,|dddcxk(r|ddk(sn|dddcxk(r|ddk(rnn|dd}|rt|�}|j|	j�|f�|j�}||kr��|||j�}|dvr|j|||�|S|jd	�r|j||�|S|j!||�||j"vr|j%|�|S)
Nrrr4rV�'r5�")r�/>rf)r#�check_for_whole_start_tagr�tagfind_tolerantrArJrHr&r�attrfind_tolerantr�append�stripr=�endswith�handle_startendtag�handle_starttag�CDATA_CONTENT_ELEMENTSr+)
rrN�endposr�attrsrArR�tag�m�attrname�rest�	attrvaluerJs
             rrBzHTMLParser.parse_starttag-s���#����/�/��2���A�:��M��,�,��&�q��0����� �&�&�w��!��4���I�I�K��"�[�[��^�1�1�3�3���s��&�j�!�'�'���3�A���()����1�a�(8�%�H�d�I�� �	��2�A��$�8�)�B�C�.�8��2�A��#�7��2�3��7�%�a��O�	��$�Y�/�	��L�L�(�.�.�*�I�6�7�����A��&�j��a���%�%�'���k�!����W�Q�v�.�/��M��<�<����#�#�C��/�
�
�
� � ��e�,��d�1�1�1��#�#�C�(��
rc�H�|j}tj||�}|rt|j�}|||dz}|dk(r|dzS|dk(r6|j	d|�r|dzS|j	d|�ry||kDr|S|dzS|dk(ry|dvry||kDr|S|dzStd	��)
Nrr�/rfr4r5rz6abcdefghijklmnopqrstuvwxyz=/ABCDEFGHIJKLMNOPQRSTUVWXYZzwe should not get here!)r�locatestarttagend_tolerantrArJr?�AssertionError)rrNrrsrP�nexts      rrgz$HTMLParser.check_for_whole_start_tagYs����,�,��&�,�,�W�a�8�������A��1�Q�q�S�>�D��s�{��1�u���s�{��%�%�d�A�.��q�5�L��%�%�c�1�-���q�5��H��q�5�L��r�z���5�6���1�u����1�u���6�7�7rc���|j}tj||dz�}|sy|j�}tj||�}|s�|j�|j|||�|Stj||dz�}|s!|||dzdk(r|dzS|j|�S|jd�j�}|jd|j��}|j|�|dzS|jd�j�}|j�%||jk7r|j|||�|S|j|�|j�|S)Nrr5r4rVz</>r)r�	endendtagr;rJ�
endtagfindrArr=rhrZrHr&r8�
handle_endtagr.)rrNrrAr[�	namematch�tagnamer*s        rrCzHTMLParser.parse_endtag{s[���,�,��� � ��!�A�#�.�����	�	���� � ��!�,������*�� � ���5�!1�2���(�.�.�w��!��<�I���1�Q�q�S�>�U�*��Q�3�J��3�3�A�6�6��o�o�a�(�.�.�0�G�
�L�L��i�m�m�o�6�E����w�'���7�N��{�{�1�~�#�#�%���?�?�&��t���&�� � ���5�!1�2������4� ������rc�J�|j||�|j|�yr-)rnr�rrrrqs   rrmzHTMLParser.handle_startendtag�s �����S�%�(����3�rc��yr-�r�s   rrnzHTMLParser.handle_starttag����rc��yr-r�)rrrs  rrzHTMLParser.handle_endtag�r�rc��yr-r��rrSs  rrIzHTMLParser.handle_charref�r�rc��yr-r�r�s  rrLzHTMLParser.handle_entityref�r�rc��yr-r�rs  rr=zHTMLParser.handle_data�r�rc��yr-r�rs  rr]zHTMLParser.handle_comment�r�rc��yr-r�)r�decls  rrYzHTMLParser.handle_decl�r�rc��yr-r�rs  rrbzHTMLParser.handle_pi�r�rc��yr-r�rs  r�unknown_declzHTMLParser.unknown_decl�r�r)r)�__name__�
__module__�__qualname__�__doc__rorr
rr!r#r$r+r.rrFrZrErBrgrCrmrnrrIrLr=r]rYrbr��
__classcell__)rs@rrr>s�����*1��+/������O�$�N��u#�t/�*	�	�(�X8�D%�P �

�
�
�
�
�
�
�
�
r)r�r'�_markupbase�htmlr�__all__r(rrMrKrGr@ra�commentcloserhri�VERBOSEryr}r~�
ParserBaserr�rr�<module>r�s��"�
����.�� �R�Z�Z��'��
�R�Z�Z��
%�
��B�J�J�>�?�	�
�"�*�*�@�
A���r�z�z�+�&��
�"�*�*�S�/���r�z�z�)�$���2�:�:�L�M���B�J�J�=�>��(�R�Z�Z�)��Z�Z���
�B�J�J�s�O�	��R�Z�Z�>�
?�
�J
��'�'�J
r

?>