ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/lxml/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/lxml/__pycache__/sax.cpython-311.pyc

�

�܋f�$���dZddlmZddlmZddlmZddlmZm	Z	ddlm
Z
mZGd�dej��Z
d	�ZGd
�de��ZGd�d
e��Zd�ZdS)a?
SAX-based adapter to copy trees from/to the Python standard library.

Use the `ElementTreeContentHandler` class to build an ElementTree from
SAX events.

Use the `ElementTreeProducer` class or the `saxify()` function to fire
the SAX events of an ElementTree against a SAX ContentHandler.

See https://lxml.de/sax.html
�)�absolute_import)�ContentHandler)�etree)�ElementTree�
SubElement)�Comment�ProcessingInstructionc��eZdZdZdS)�SaxErrorzGeneral SAX error.
    N)�__name__�
__module__�__qualname__�__doc__���[/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/lxml/sax.pyrrs���������rrc�x�|ddkr+t|dd��dd����Sd|fS)Nr�{��})�tuple�split)�tags r�	_getNsTagrs=��
�1�v��}�}��S����W�]�]�3��*�*�+�+�+��S�y�rc��eZdZdZdd�Zd�Zeeej���Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dd�Zd
�Zd�Zdd�Zd�Zd�ZeZdS)�ElementTreeContentHandlerz/Build an lxml ElementTree from SAX events.
    Nc��tj|��d|_g|_g|_d|_ddgi|_i|_|�tj	}||_
dS�N)r�__init__�_root�_root_siblings�_element_stack�_default_ns�_ns_mapping�
_new_mappingsr�Element�_makeelement)�self�makeelements  rrz"ElementTreeContentHandler.__init__&sd�����%�%�%���
� ��� ������!�T�F�,���������-�K�'����rc�*�t|j��S)z=Contains the generated ElementTree after parsing is finished.)rr �r(s r�
_get_etreez$ElementTreeContentHandler._get_etree2s���4�:�&�&�&r)�docc��dSrr)r(�locators  r�setDocumentLocatorz,ElementTreeContentHandler.setDocumentLocator8����rc��dSrrr+s r�
startDocumentz'ElementTreeContentHandler.startDocument;r1rc��dSrrr+s r�endDocumentz%ElementTreeContentHandler.endDocument>r1rc��||j|<	|j|�|��n#t$r|g|j|<YnwxYw|�	||_dSdSr)r%r$�append�KeyErrorr#)r(�prefix�uris   r�startPrefixMappingz,ElementTreeContentHandler.startPrefixMappingAs}��%(���6�"�	-���V�$�+�+�C�0�0�0�0���	-�	-�	-�(+�u�D��V�$�$�$�	-�����>�"�D�����>s� -�A�Ac�j�|j|}|���|�|d|_dSdS�N���)r$�popr#)r(r9�ns_uri_lists   r�endPrefixMappingz*ElementTreeContentHandler.endPrefixMappingJs=���&�v�.���������>�*�2��D�����>rc�N�|\}}|rd|z}n|jrd|j�d|��}n|}|S)N�{%s}%srr)r#)r(�
ns_name_tuple�ns_uri�
local_name�el_tags     r�	_buildTagz#ElementTreeContentHandler._buildTagPsQ��*���
��	 ��
�-�F�F�
�
�	 �	 �!%�!1�!1�!1�:�:�>�F�F��F��
rc�r�|�|��}|r`i}	|���}n$#t$r|���}YnwxYw|D] \}}|drd|z}	n|d}	|||	<�!nd}|j}
|j�d|�|||j��x}|_|jr/t|d��r|jD]}|�
|���|jdd�=nt|
d|||j��}|
�|��|j�
��dS)NrrCr�addpreviousr>)rH�	iteritems�AttributeError�itemsr"r r'r%r!�hasattrrJrr7�clear)
r(�ns_name�qname�
attributes�el_name�attrs�iter_attributes�
name_tuple�value�	attr_name�
element_stack�element�siblings
             r�startElementNSz(ElementTreeContentHandler.startElementNSZs����.�.��)�)���	��E�
5�",�"6�"6�"8�"8����!�
5�
5�
5�",�"2�"2�"4�"4����
5����&5�
)�
)�!�
�E��a�=�.� (�:� 5�I�I� *�1�
�I�#(��i� � �
)��E��+�
��:���'�'����8J�K�K�
L�G�d�j��"�
1�w�w�
�'F�'F�
1�#�2�1�1�G��'�'��0�0�0�0��#�A�A�A�&�&� ��r�!2�G�!&��(:�<�<�G����W�%�%�%��� � �"�"�"�"�"s�0�A�Ac��t||��}|j�|j�|��dS|jd�|��dSr=)r	r r!r7r")r(�target�data�pis    r�processingInstructionz/ElementTreeContentHandler.processingInstruction{sX��
"�6�4�
0�
0���:����&�&�r�*�*�*�*�*����#�*�*�2�.�.�.�.�.rc��|j���}|�|��}||jkrt	d|z���dS)NzUnexpected element closed: )r"r?rHrr)r(rPrQrZrGs     r�endElementNSz&ElementTreeContentHandler.endElementNS�sP���%�)�)�+�+������(�(���W�[� � ��8�6�A�B�B�B�!� rc��|r+td�|���D����}|�d|f||��dS)Nc� �g|]\}}d|f|f��Srr)�.0�k�vs   r�
<listcomp>z:ElementTreeContentHandler.startElement.<locals>.<listcomp>�s$��C�C�C���1�t�Q�i��^�C�C�Cr)�dictrMr\)r(�namerRs   r�startElementz&ElementTreeContentHandler.startElement�sZ���	��C�C�
�0@�0@�0B�0B�C�C�C���J�	
���T�4�L�$�
�;�;�;�;�;rc�6�|�d|f|��dSr)rc)r(rks  r�
endElementz$ElementTreeContentHandler.endElement�s"�����4��,��-�-�-�-�-rc��|jd}	|d}|jpd|z|_dS#t$r|jpd|z|_YdSwxYw)Nr>�)r"�tail�
IndexError�text)r(r_�last_elements   r�
charactersz$ElementTreeContentHandler.characters�sw���*�2�.��	A�'��+�L�!-�!2�!8�b�D� @�L������	A�	A�	A�!-�!2�!8�b�D� @�L�����	A���s�*�A	�A	r)rr
rrrr,�propertyrr0r3r5r;rArHr\rarcrlrnru�ignorableWhitespacerrrrr#s#��������
(�
(�
(�
(�'�'�'�
�H�Z�Z�%7�8�8�8�E�
�
�
�
�
�
�
�
�
�#�#�#�/�/�/����#�#�#�#�B/�/�/�C�C�C�<�<�<�<�.�.�.�A�A�A�%���rrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�ElementTreeProducerz5Produces SAX events for an element and children.
    c��	|���}n#t$r|}YnwxYw||_||_ddlm}||_|ii��|_dS)Nr)�AttributesNSImpl)�getrootrL�_element�_content_handler�xml.sax.xmlreaderr{�_attr_class�_empty_attributes)r(�element_or_tree�content_handlerrZ�
attr_classs     rrzElementTreeProducer.__init__�s���	&�%�-�-�/�/�G�G���	&�	&�	&�%�G�G�G�	&������
� /���D�D�D�D�D�D�%���!+��B��!3�!3����s��&�&c���|j���|j}t|d��r�g}|���}t|dd��turA|�|��|���}t|dd��tu�A|ddd�D]}|�|i���|�|i��t|d��rn|�	��}t|dd��turB|�|i��|�	��}t|dd��tu�B|j�
��dS)N�getpreviousrr>�getnext)r~r3r}rNr��getattrr	r7�_recursive_saxifyr�r5)r(rZ�siblingsr[s    r�saxifyzElementTreeProducer.saxify�sz����+�+�-�-�-��-���7�M�*�*�	4��H��)�)�+�+�G��'�5�$�/�/�3H�H�H�����(�(�(�!�-�-�/�/���'�5�$�/�/�3H�H�H�$�D�D�b�D�>�
4�
4���&�&�w��3�3�3�3����w��+�+�+��7�I�&�&�	,��o�o�'�'�G��'�5�$�/�/�3H�H�H��&�&�w��3�3�3�!�/�/�+�+���'�5�$�/�/�3H�H�H�	
��)�)�+�+�+�+�+rc�p�|j}|j}|tus	|turI|tur |�|j|j��|j}|r|�|��dS|j	}g}||krJ|�
��D]5\}}	|�|��|	kr|�||	f���6|�
��}
|
r`i}i}|
D]B\}
}t|
��}|||<|�|d|d|dd���||<�C|�||��}n|j}t|��\}	}|�|	|||jd���}|D]\}}|�||���|�|	|f||��|j}|r|�|��|D]}|�||���|�|	|f|��|D]\}}|�|���|j}|r|�|��dSdS)NrrT)�preferred_prefix�is_attributeF)r�)r~rrr	rar^rsrqru�nsmaprM�getr7r�_build_qnamer�r�r9r;r\r�rcrA)r(rZ�parent_nsmapr�rrq�
element_nsmap�new_prefixesr9rE�attribs�attr_values�attr_qnames�attr_ns_namerW�
attr_ns_tuple�sax_attributesrFrQr:rs�childs                      rr�z%ElementTreeProducer._recursive_saxify�s����/���k���'�>�>�S�$9�9�9��+�+�+��5�5��N�G�L�2�2�2��<�D��
1��*�*�4�0�0�0��F��
�
����L�(�(�"/�"5�"5�"7�"7�
<�
<�����#�#�F�+�+�v�5�5� �'�'�&�&�)9�;�;�;���-�-�/�/���	4��K��K�'.�
>�
>�#��e� )�,� 7� 7�
�-2��M�*�-1�->�->�!�!�$�m�A�&6�
�%)��.?�.>�.>��M�*�*�"�-�-�k�;�G�G�N�N�!�3�N�&�s�^�^���
��!�!��J�
�w�~�E�"�S�S��(�	<�	<�K�F�C��.�.�v�s�;�;�;�;��&�&�
�Z� �%��	9�	9�	9��|���	-��&�&�t�,�,�,��	9�	9�E��"�"�5�-�8�8�8�8��$�$�f�j�%9�5�A�A�A�'�	5�	5�K�F�C��,�,�V�4�4�4�4��|���	-��&�&�t�,�,�,�,�,�	-�	-rc�����|S|s|�|���kr|}nN�fd�|���D��}t|��dkr|dn|rt|��nd}|�|S|dz|zS)Nc�*��g|]\}}|�|�k�
|��Srr)rf�pfxr:rEs   �rriz4ElementTreeProducer._build_qname.<locals>.<listcomp>s2������"��c��?�s�f�}�}��'4�}�}rrr�:)r�rM�len�min)r(rErFr�r�r�r9�
candidatess `      rr�z ElementTreeProducer._build_qname�s�����>����	��	�	�*:� ;� ;�v� E� E�%�F�F�����&+�k�k�m�m����J�
"%�Z���A�!5�!5�
�1�
�
�(2��S��_�_�_��
��>�����|�j�(�(rN)rr
rrrr�r�r�rrrryry�s[��������	4�	4�	4�,�,�,�.4-�4-�4-�l)�)�)�)�)rryc�F�t||�����S)zlOne-shot helper to generate SAX events from an XML tree and fire
    them against a SAX ContentHandler.
    )ryr�)r�r�s  rr�r�s �����@�@�G�G�I�I�IrN)r�
__future__r�xml.sax.handlerr�lxmlr�
lxml.etreerrrr	�	LxmlErrorrrr�objectryr�rrr�<module>r�s6��
�
�'�&�&�&�&�&�*�*�*�*�*�*�������.�.�.�.�.�.�.�.�5�5�5�5�5�5�5�5������u�����
���y%�y%�y%�y%�y%��y%�y%�y%�xp)�p)�p)�p)�p)�&�p)�p)�p)�fJ�J�J�J�Jr

Zerion Mini Shell 1.0