Edit File: html5parser.cpython-311.pyc
� ������Fh�!���������������������������d�Z�ddlZddlZddlmZ�ddlmZ�ddlm Z �ddl mZmZm Z � �eZn#�e$�r�eefZY�nw�xY�w �ddlmZ�n#�e$�r �ddlmZ�Y�nw�xY�w �ddlmZ�n#�e$�r �ddlmZ�Y�nw�xY�w�G�d ��d e������������Z �ddlmZ��G�d��d e������������Z�e��������������Zn#�e$�r�Y�nw�xY�wd��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�������������������������e�Zd�ZdZdd�ZdS�)r���z*An html5lib HTML parser with lxml as tree.Fc������������������:�����t����������j��������|�f|t����������d�|���d�S��N)�strict�tree)�_HTMLParser�__init__r�����selfr����kwargss��� �w/builddir/build/BUILD/imunify360-venv-2.5.3/opt/imunify360/venv/lib64/python3.11/site-packages/lxml/html/html5parser.pyr���zHTMLParser.__init__���s(��������T�M�&�{�M�M�f�M�M�M�M�M�����N�F��__name__� __module__�__qualname__�__doc__r�����r���r���r���r������s4��������������4�4�N��N��N��N��N��Nr���r���)�XHTMLParserc�������������������������e�Zd�ZdZdd�ZdS�)r���z+An html5lib XHTML Parser with lxml as tree.Fc������������������:�����t����������j��������|�f|t����������d�|���d�S�r ���)�_XHTMLParserr���r���r���s��� r���r���zXHTMLParser.__init__*���s(�������!�$�R�v�K�R�R�6�R�R�R�R�Rr���Nr���r���r���r���r���r���r���'���s4��������������9�9� S�� S�� S�� S�� S�� Sr���r���c������������������t�����|�����������������������|������������}|�|S�|�����������������������dt�����������d|��������������S�)N�{�})�findr���)r����tag�elems��� r���� _find_tagr(���0���s;�������9�9�S�>�>�D������9�9�9����#�#�6�7�7�7r���c������������������������t����������|�t����������������������st����������d�������������|�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_fromstringr7���7���s���������d�H�%�%��+��)�*�*�*� �~����G����D�%�!8�!8���� �� � -�����6�<��(�(��(�(�0�0�2�2�2r���Fc������������������t����t����������|�t����������������������st����������d�������������|�t����������}i�}|�t����������|�t����������������������rd}|�||d<����|j��������|�dfi�|��}|rWt����������|d���������t����������������������r<|r:|d��������������������������������������������rt����������j��������d|d���������z���������������|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+����divr���zThere is leading text: %r) r,���r-���r.���r/���r0���� parseFragment�stripr����ParserError)r3����no_leading_textr4���r5���r6����childrens��� r����fragments_fromstringr?���O���s���������d�H�%�%��+��)�*�*�*� �~����G����D�%�!8�!8���� �� � -����#�v�#�D�%�;�;�7�;�;�H����J�x��{�H�5�5����� ���{� � �"�"�� 5��'�(C�(0���)4��5��5��5�����Or���c������������������|����t����������|�t����������������������st����������d�������������t����������|������������}t ����������|�|||��������������}|rjt����������|t����������������������sd}t����������|������������}|r@t����������|d���������t����������������������r|d���������|_��������|d=�|���������������������|�������������|S�|st����������j ��������d�������������t����������|������������dk����rt����������j ��������d�������������|d���������}|j��������r5|j�������������������������������������������rt����������j ��������d|j��������z���������������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*���)r4���r5���r=���r9���r���zNo elements found����zMultiple elements foundzElement followed by text: %rN) r,���r-���r.����boolr?���r����text�extendr���r<����len�tailr;���)r3���� create_parentr4���r5����accept_leading_text�elements�new_root�results��� r����fragment_fromstringrL���q���sU�������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��Mr���c�����������������������t����������|�t����������������������st����������d�������������t����������|�||�������������}|�dd����������}t����������|t����������������������r|���������������������dd������������}|����������������������������������������������������������������������}|���������������������d������������s|���������������������d������������r|S�t����������|d ������������}t����������|������������r|S�t����������|d ������������}t����������|������������dk����rT|j��������r|j�������������������������������������������s4|d���������j ��������r|d���������j �������������������������������������������s|d ���������S�t����������|������������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*���)r5���r4���N�2����ascii�replacez<htmlz <!doctype�head�bodyrA������r���r9����span)r,���r-���r.���r7���r0����decode�lstrip�lower� startswithr(���rE���rC���r;���rF���r���r&���)r3���r4���r5����doc�startrQ���rR���s��� 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�� �!��&�&�����������Kr���c������������������������|�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_filer4���r5����fpr6���s��� r���r1���r1�������s���������~����*�H�5�5�� !� !��� �!�M�� �-� .� .��!� �)� *� *��� � �M�� �&�� -� -��� � �M��G����.� -�����6�<��&�&�g�&�&�&r���c�����������������������t����������|�������������d���������}|sdS�t����������j��������dk����r#|t����������j��������v�rt����������|������������dk����rdS�dS�)Nr���F�win32rA���T)r ����sys�platform�string� ascii_lettersrE���)�str�schemes��� r���r^���r^�������sU������ �c�]�]�1� �F�����u� �,�'� !� !��f�*�*�*��F���q� � ��u��tr���)NN)FNN)$r���rd���rf����html5libr���r���� html5lib.treebuilders.etree_lxmlr����lxmlr���� lxml.htmlr���r���r���� basestringr-���� NameErrorr0���rh����urllib2r ����ImportError�urllib.requestr ����urllib.parser���r!����xhtml_parserr(���r7���r?���rL���r[���r1���r^���r/���r���r���r����<module>ru������s���������� � � �� � � � ��.��.��.��.��.��.��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�0�05�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"