403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/bs4/builder/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/bs4/builder/__pycache__/_htmlparser.cpython-311.pyc
�

S�c�5���dZdZdgZddlmZddlZddlZddlmZm	Z	m
Z
mZmZddl
mZmZddlmZmZmZmZd	ZGd
�dee��ZGd�de��ZdS)
zCUse the HTMLParser library to parse HTML files that aren't too bad.�MIT�HTMLParserTreeBuilder�)�
HTMLParserN)�CData�Comment�Declaration�Doctype�ProcessingInstruction)�EntitySubstitution�
UnicodeDammit)�DetectsXMLParsedAsHTML�HTML�HTMLTreeBuilder�STRICTzhtml.parserc�`�eZdZdZdZdZd�Zd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�ZdS)�BeautifulSoupHTMLParserz�A subclass of the Python standard library's HTMLParser class, which
    listens for HTMLParser events and translates them into calls
    to Beautiful Soup's tree construction API.
    �ignore�replacec��|�d|j��|_tj|g|�Ri|��g|_|���dS)aConstructor.

        :param on_duplicate_attribute: A strategy for what to do if a
            tag includes the same attribute more than once. Accepted
            values are: REPLACE (replace earlier values with later
            ones, the default), IGNORE (keep the earliest value
            encountered), or a callable. A callable must take three
            arguments: the dictionary of attributes already processed,
            the name of the duplicate attribute, and the most recent value
            encountered.           
        �on_duplicate_attributeN)�pop�REPLACErr�__init__�already_closed_empty_element�_initialize_xml_detector)�self�args�kwargss   �9/usr/lib/python3/dist-packages/bs4/builder/_htmlparser.pyrz BeautifulSoupHTMLParser.__init__-sf��'-�j�j�$�d�l�'
�'
��#�	��D�2�4�2�2�2�6�2�2�2�-/��)��%�%�'�'�'�'�'�c�`�|�||d���}|�|��dS)z�Handle an incoming empty-element tag.

        This is only called when the markup looks like <tag/>.

        :param name: Name of the tag.
        :param attrs: Dictionary of the tag's attributes.
        F)�handle_empty_elementN)�handle_starttag�
handle_endtag)r�name�attrs�tags    r�handle_startendtagz*BeautifulSoupHTMLParser.handle_startendtagIs8���"�"�4��U�"�K�K�����4� � � � � r Tc��i}|D]F\}}|�d}||vr2|j}||jkrn$|d|jfvr|||<n||||��n|||<d}�G|���\}	}
|j�|dd||	|
���}|r:|jr3|r1|�|d���|j�	|��|j
�|�|��dSdS)a3Handle an opening tag, e.g. '<tag>'

        :param name: Name of the tag.
        :param attrs: Dictionary of the tag's attributes.
        :param handle_empty_element: True if this tag is known to be
            an empty-element tag (i.e. there is not expected to be any
            closing tag).
        N�z"")�
sourceline�	sourceposF)�check_already_closed)r�IGNOREr�getpos�soupr#�is_empty_elementr$r�append�	_root_tag�_root_tag_encountered)rr%r&r"�	attr_dict�key�value�on_dupe�	attrvaluer+r,r's            rr#z'BeautifulSoupHTMLParser.handle_starttagXsG���	��	�	�J�C���}����i����5���d�k�)�)����t�|� 4�4�4�%*�I�c�N�N��G�I�s�E�2�2�2�2�!&�	�#���I�I� $���
�
��
�I��i�'�'��$��i�J��(�
�
���	;�3�'�	;�,@�	;�
���t�%��@�@�@�
�-�4�4�T�:�:�:��>�!��&�&�t�,�,�,�,�,�"�!r c��|r%||jvr|j�|��dS|j�|��dS)z�Handle a closing tag, e.g. '</tag>'
        
        :param name: A tag name.
        :param check_already_closed: True if this tag is expected to
           be the closing portion of an empty-element tag,
           e.g. '<tag></tag>'.
        N)r�remover0r$)rr%r-s   rr$z%BeautifulSoupHTMLParser.handle_endtag�sT�� �	*�D�D�,M�$M�$M�

�-�4�4�T�:�:�:�:�:��I�#�#�D�)�)�)�)�)r c�:�|j�|��dS)z4Handle some textual data that shows up between tags.N)r0�handle_data�r�datas  rr=z#BeautifulSoupHTMLParser.handle_data�s���	���d�#�#�#�#�#r c�J�|�d��r$t|�d��d��}nH|�d��r$t|�d��d��}nt|��}d}|dkrO|jjdfD]@}|s�	t|g���|��}�*#t$r
}Yd}~�9d}~wwxYw|s/	t|��}n#ttf$r
}Yd}~nd}~wwxYw|pd}|�|��dS)z�Handle a numeric character reference by converting it to the
        corresponding Unicode character and treating it as textual
        data.

        :param name: Character number, possibly in hexadecimal.
        �x��XN�zwindows-1252u�)�
startswith�int�lstripr0�original_encoding�	bytearray�decode�UnicodeDecodeError�chr�
ValueError�
OverflowErrorr=)rr%�	real_namer?�encoding�es      r�handle_charrefz&BeautifulSoupHTMLParser.handle_charref�sa���?�?�3���	"��D�K�K��,�,�b�1�1�I�I�
�_�_�S�
!�
!�	"��D�K�K��,�,�b�1�1�I�I��D�	�	�I����s�?�?�"�Y�8�.�I�
�
������$�i�[�1�1�8�8��B�B�D�D��)�����D�D�D�D����������	�
��9�~�~�����
�.�
�
�
����������
�����2�2����������s$�#C�
C�C�C,�,D�Dc��tj�|��}|�|}nd|z}|�|��dS)z�Handle a named entity reference by converting it to the
        corresponding Unicode character(s) and treating it as textual
        data.

        :param name: Name of the entity reference.
        Nz&%s)r�HTML_ENTITY_TO_CHARACTER�getr=)rr%�	characterr?s    r�handle_entityrefz(BeautifulSoupHTMLParser.handle_entityref�sL��'�?�C�C�D�I�I�	�� ��D�D��4�<�D���������r c��|j���|j�|��|j�t��dS)zOHandle an HTML comment.

        :param data: The text of the comment.
        N)r0�endDatar=rr>s  r�handle_commentz&BeautifulSoupHTMLParser.handle_comment�sJ��
	
�	�������	���d�#�#�#��	���'�"�"�"�"�"r c���|j���|td��d�}|j�|��|j�t��dS)zYHandle a DOCTYPE declaration.

        :param data: The text of the declaration.
        zDOCTYPE N)r0rY�lenr=r	r>s  r�handle_declz#BeautifulSoupHTMLParser.handle_decl�s`��
	
�	�������C�
�O�O�$�$�%���	���d�#�#�#��	���'�"�"�"�"�"r c�:�|����d��rt}|td��d�}nt}|j���|j�|��|j�|��dS)z{Handle a declaration of unknown type -- probably a CDATA block.

        :param data: The text of the declaration.
        zCDATA[N)�upperrErr\rr0rYr=)rr?�clss   r�unknown_declz$BeautifulSoupHTMLParser.unknown_decl�s���
�:�:�<�<�"�"�8�,�,�	��C���H�
�
���'�D�D��C��	�������	���d�#�#�#��	���#�����r c���|j���|j�|��|�|��|j�t��dS)z\Handle a processing instruction.

        :param data: The text of the instruction.
        N)r0rYr=�_document_might_be_xmlr
r>s  r�	handle_piz!BeautifulSoupHTMLParser.handle_pis_��
	
�	�������	���d�#�#�#��#�#�D�)�)�)��	���/�0�0�0�0�0r N)T)�__name__�
__module__�__qualname__�__doc__r.rrr(r#r$r=rRrWrZr]rard�r rrr#s����������F��G�(�(�(�8
!�
!�
!�5-�5-�5-�5-�n*�*�*�*�$$�$�$�&�&�&�P���&#�#�#�#�#�#����1�1�1�1�1r rc�P��eZdZdZdZdZeZeee	gZ
dZd�fd�	Z		d	d�Z
d�Z�xZS)
rzpA Beautiful soup `TreeBuilder` that uses the `HTMLParser` parser,
    found in the Python standard library.
    FTNc���t��}dD] }||vr|�|��}|||<�!tt|��jdi|��|pg}|pi}|�|��d|d<||f|_dS)a�Constructor.

        :param parser_args: Positional arguments to pass into 
            the BeautifulSoupHTMLParser constructor, once it's
            invoked.
        :param parser_kwargs: Keyword arguments to pass into 
            the BeautifulSoupHTMLParser constructor, once it's
            invoked.
        :param kwargs: Keyword arguments for the superclass constructor.
        )rF�convert_charrefsNri)�dictr�superrr�update�parser_args)rrp�
parser_kwargsr�extra_parser_kwargs�argr7�	__class__s       �rrzHTMLParserTreeBuilder.__init__s����#�f�f��.�	1�	1�C��f�}�}��
�
�3����+0�#�C�(��3��#�T�*�*�3�=�=�f�=�=�=�!�'�R��%�+��
����0�1�1�1�,1�
�(�)�'��7����r c#�K�t|t��r
|dddfV�dS|g}|g}||g}t|||d|���}|j|j|j|jfV�dS)a�Run any preliminary steps necessary to make incoming markup
        acceptable to the parser.

        :param markup: Some markup -- probably a bytestring.
        :param user_specified_encoding: The user asked to try this encoding.
        :param document_declared_encoding: The markup itself claims to be
            in this encoding.
        :param exclude_encodings: The user asked _not_ to try any of
            these encodings.

        :yield: A series of 4-tuples:
         (markup, encoding, declared encoding,
          has undergone character replacement)

         Each 4-tuple represents a strategy for converting the
         document to Unicode and parsing it. Each strategy will be tried 
         in turn.
        NFT)�known_definite_encodings�user_encodings�is_html�exclude_encodings)�
isinstance�strr�markuprH�declared_html_encoding�contains_replacement_characters)	rr|�user_specified_encoding�document_declared_encodingryrvrw�
try_encodings�dammits	         r�prepare_markupz$HTMLParserTreeBuilder.prepare_markup2s�����*�f�c�"�"�	��4��u�-�-�-�-��F�%<�#<� �5�5��0�2L�M�
���%=�)��/�
�
�
���}�f�6��,��5�7�	7�	7�	7�	7�	7r c��|j\}}t|i|��}|j|_|�|��|���g|_dS)z{Run some incoming markup through some parsing process,
        populating the `BeautifulSoup` object in self.soup.
        N)rprr0�feed�closer)rr|rr�parsers     rr�zHTMLParserTreeBuilder.feedcsX���'���f�(�$�9�&�9�9���i������F����������.0��+�+�+r )NN)NNN)rerfrgrh�is_xml�	picklable�
HTMLPARSER�NAMErr�features�TRACKS_LINE_NUMBERSrr�r��
__classcell__)rts@rrrs�����������F��I��D��d�F�#�H���8�8�8�8�8�8�2>B�JN�/7�/7�/7�/7�b	1�	1�	1�	1�	1�	1�	1r )rh�__license__�__all__�html.parserr�sys�warnings�bs4.elementrrrr	r
�
bs4.dammitrr�bs4.builderr
rrrr�rrrir r�<module>r�s[��I�I������#�"�"�"�"�"�
�
�
�
�������������������9�8�8�8�8�8�8�8��������������
�f1�f1�f1�f1�f1�j�*@�f1�f1�f1�R`1�`1�`1�`1�`1�O�`1�`1�`1�`1�`1r 

Youez - 2016 - github.com/yon3zu
LinuXploit