Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/lxml/html/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/lxml/html/__pycache__/html5parser.cpython-311.pyc

�

�܋f�!���dZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
	eZn#e$reefZYnwxYw	ddlmZn#e$r	ddlmZYnwxYw	ddlmZn#e$r	ddlmZYnwxYwGd	�d
e��Z	ddlmZGd�d
e��Ze��Zn#e$rYnwxYwd�Zdd�Z		dd�Z		dd�Zdd�Z dd�Z!d�Z"e��Z#dS)z?
An interface to html5lib that mimics the lxml.html interface.
�N)�
HTMLParser)�TreeBuilder)�etree)�Element�XHTML_NAMESPACE�_contains_block_level_tag)�urlopen)�urlparsec��eZdZdZdd�ZdS)rz*An html5lib HTML parser with lxml as tree.Fc�:�tj|f|td�|��dS�N)�strict�tree)�_HTMLParser�__init__r��selfr�kwargss   �h/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/lxml/html/html5parser.pyrzHTMLParser.__init__s(����T�M�&�{�M�M�f�M�M�M�M�M�N�F��__name__�
__module__�__qualname__�__doc__r�rrrrs4������4�4�N�N�N�N�N�Nrr)�XHTMLParserc��eZdZdZdd�ZdS)rz+An html5lib XHTML Parser with lxml as tree.Fc�:�tj|f|td�|��dSr
)�_XHTMLParserrrrs   rrzXHTMLParser.__init__*s(���!�$�R�v�K�R�R�6�R�R�R�R�RrNrrrrrrr's4������9�9�	S�	S�	S�	S�	S�	Srrc�t�|�|��}|�|S|�dt�d|����S)N�{�})�findr)r�tag�elems   r�	_find_tagr(0s;���9�9�S�>�>�D������9�9�9����#�#�6�7�7�7rc���t|t��std���|�t}i}|�t|t��rd}|�||d<|j|fi|�����S)z�
    Parse a whole document into a string.

    If `guess_charset` is true, or if the input is not Unicode but a
    byte string, the `chardet` library will perform charset guessing
    on the string.
    �string requiredNT�
useChardet)�
isinstance�_strings�	TypeError�html_parser�bytes�parse�getroot)�html�
guess_charset�parser�optionss    r�document_fromstringr77s����d�H�%�%�+��)�*�*�*�
�~����G����D�%�!8�!8���
�� � -�����6�<��(�(��(�(�0�0�2�2�2rFc�t�t|t��std���|�t}i}|�t|t��rd}|�||d<|j|dfi|��}|rWt|dt��r<|r:|d���rtjd|dz���|d=|S)a`Parses several HTML elements, returning a list of elements.

    The first item in the list may be a string.  If no_leading_text is true,
    then it will be an error if there is leading text, and it will always be
    a list of only elements.

    If `guess_charset` is true, the `chardet` library will perform charset
    guessing on the string.
    r*NFr+�divrzThere is leading text: %r)	r,r-r.r/r0�
parseFragment�stripr�ParserError)r3�no_leading_textr4r5r6�childrens      r�fragments_fromstringr?Os����d�H�%�%�+��)�*�*�*�
�~����G����D�%�!8�!8���
�� � -����#�v�#�D�%�;�;�7�;�;�H���J�x��{�H�5�5���	���{� � �"�"�
5��'�(C�(0���)4�5�5�5�����Orc�|�t|t��std���t|��}t	||||���}|rjt|t��sd}t|��}|r@t|dt��r|d|_|d=|�|��|S|stj	d���t|��dkrtj	d���|d}|jr5|j���rtj	d|jz���d	|_|S)
a�Parses a single HTML element; it is an error if there is more than
    one element, or if anything but whitespace precedes or follows the
    element.

    If 'create_parent' is true (or is a tag name) then a parent node
    will be created to encapsulate the HTML in a single element.  In
    this case, leading or trailing text is allowed.

    If `guess_charset` is true, the `chardet` library will perform charset
    guessing on the string.
    r*)r4r5r=r9rzNo elements found�zMultiple elements foundzElement followed by text: %rN)
r,r-r.�boolr?r�text�extendrr<�len�tailr;)r3�
create_parentr4r5�accept_leading_text�elements�new_root�results        r�fragment_fromstringrLqsU���d�H�%�%�+��)�*�*�*��}�-�-��#��M�&�/�/�1�1�1�H��	��-��2�2�	"�!�M��=�)�)���	&��(�1�+�x�0�0�
 � (����
��Q�K��O�O�H�%�%�%����5��� 3�4�4�4�
�8�}�}�q����� 9�:�:�:�
�a�[�F�
�{�N�v�{�(�(�*�*�N��� >��� L�M�M�M��F�K��Mrc���t|t��std���t|||���}|dd�}t|t��r|�dd��}|������}|�d��s|�d��r|St|d	��}t|��r|St|d
��}t|��dkrT|jr|j���s4|dj
r|dj
���s|d
St|��rd|_nd|_|S)a�Parse the html, returning a single element/document.

    This tries to minimally parse the chunk of text, without knowing if it
    is a fragment or a document.

    'base_url' will set the document's base_url attribute (and the tree's
    docinfo.URL)

    If `guess_charset` is true, or if the input is not Unicode but a
    byte string, the `chardet` library will perform charset guessing
    on the string.
    r*)r5r4N�2�ascii�replacez<htmlz	<!doctype�head�bodyrA���rr9�span)r,r-r.r7r0�decode�lstrip�lower�
startswithr(rErCr;rFrr&)r3r4r5�doc�startrQrRs       r�
fromstringr[�sq���d�H�%�%�+��)�*�*�*�
�d�6�,9�;�;�;�C�
��"��I�E��%����1����W�i�0�0���L�L�N�N� � �"�"�E����� � ��E�$4�$4�[�$A�$A���
��S�&�!�!�D��4�y�y���
��S�&�!�!�D�	�D�	�	�Q����	������1B�1B���b���	�&*�2�h�m�&9�&9�&;�&;�	��A�w��
!��&�&����������Krc���|�t}t|t��s|}|�d}n7t|��rt	|��}|�d}nt|d��}|�d}i}|r||d<|j|fi|��S)a*Parse a filename, URL, or file-like object into an HTML document
    tree.  Note: this returns a tree, not an element.  Use
    ``parse(...).getroot()`` to get the document root.

    If ``guess_charset`` is true, the ``useChardet`` option is passed into
    html5lib to enable character detection.  This option is on by default
    when parsing from URLs, off by default when parsing from file(-like)
    objects (which tend to return Unicode more often than not), and on by
    default when parsing from a file path (which is read in binary mode).
    NFT�rbr+)r/r,r-�_looks_like_urlr	�openr1)�filename_url_or_filer4r5�fpr6s     rr1r1�s����~����*�H�5�5�
!�
!��� �!�M��	�-�	.�	.�!�
�)�
*�
*��� � �M��
�&��
-�
-��� � �M��G��.� -�����6�<��&�&�g�&�&�&rc��t|��d}|sdStjdkr#|tjvrt|��dkrdSdS)NrF�win32rAT)r
�sys�platform�string�
ascii_lettersrE)�str�schemes  rr^r^�sU��
�c�]�]�1�
�F����u�

�,�'�
!�
!��f�*�*�*��F���q� � ��u��tr)NN)FNN)$rrdrf�html5librr� html5lib.treebuilders.etree_lxmlr�lxmlr�	lxml.htmlrrr�
basestringr-�	NameErrorr0rh�urllib2r	�ImportError�urllib.requestr
�urllib.parserr!�xhtml_parserr(r7r?rLr[r1r^r/rrr�<module>rus������
�
�
�
�
�
�
�.�.�.�.�.�.�8�8�8�8�8�8�������I�I�I�I�I�I�I�I�I�I���H�H�������s�|�H�H�H�����'����������'�'�'�&�&�&�&�&�&�&�&�'����&�!�!�!�!�!�!�!���&�&�&�%�%�%�%�%�%�%�%�&����N�N�N�N�N��N�N�N�!�4�4�4�4�4�4�S�S�S�S�S�l�S�S�S��;�=�=�L�L���	�	�	��D�	����8�8�8�3�3�3�3�005�48�����D-2�37�)�)�)�)�X3�3�3�3�l!'�!'�!'�!'�H
�
�
��j�l�l���sA�+�	7�7�A�A�A�A�A)�(A)�;B�B"�!B"

Hacked By AnonymousFox1.0, Coded By AnonymousFox