%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/xml/dom/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/xml/dom/__pycache__/pulldom.cpython-312.pyc

�

���fu-����ddlZddlZdZdZdZdZdZdZdZ	d	Z
Gd
�dejj�Z
Gd�d
�ZGd�d�ZGd�de
�ZdZdd�Zdd�Zy)�N�
START_ELEMENT�END_ELEMENT�COMMENT�START_DOCUMENT�END_DOCUMENT�PROCESSING_INSTRUCTION�IGNORABLE_WHITESPACE�
CHARACTERSc�|�eZdZdZdZdd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zy)�PullDOMNc�6�ddlm}||_ddg|_|j|_g|_|j
j|_	|j
j|_|dig|_
|jd|_g|_y#t$rY�1wxYw)Nr)�
XML_NAMESPACE�xml���)
�xml.domr�documentFactory�
firstEvent�	lastEvent�elementStack�append�push�pop�AttributeError�_ns_contexts�_current_context�pending_events)�selfrrs   �&/usr/lib/python3.12/xml/dom/pulldom.py�__init__zPullDOM.__init__s���)�.�����,������������%�%�,�,��	�	��(�(�,�,�D�H�,�E�2�3��� $� 1� 1�"� 5��� �����	��	�s�B�	B�Bc�>�|jd}|jd=|S�Nr)r)r�results  rrzPullDOM.pop!s%���"�"�2�&�����b�!��
�c��||_y�N)�_locator)r�locators  r�setDocumentLocatorzPullDOM.setDocumentLocator&s	����
r#c��t|d�sg|_|jj|xsd|f�|jj|jj��|xsd|j|<y)N�_xmlns_attrs�xmlns)�hasattrr*rrr�copy)r�prefix�uris   r�startPrefixMappingzPullDOM.startPrefixMapping)si���t�^�,� "�D����� � �&�"3�G�S�!9�:���� � ��!6�!6�!;�!;�!=�>�%+�^�t����c�"r#c�B�|jj�|_yr%)rrr)rr.s  r�endPrefixMappingzPullDOM.endPrefixMapping0s�� $� 1� 1� 5� 5� 7��r#c���d}t|dd�}|�"|D]\}}||j||f<�g|_|\}}	|rZ|�|j|}
|
r	|
dz|	z}n|	}|jr|jj||�}nM|j
||�}n:|jr|jj|	�}n|j
d|	�}|j�D]�\}}|\}}
||k(r;|
dk(r|
}nd|
z}|jj||�}|j|�nx|rJ|j|}
|
r	|
dz|
z}n|
}|jj||�}|j|�n,|jj|
�}|j|�||_
��t|fdg|jd<|jd|_|j!|�y)Nzhttp://www.w3.org/2000/xmlns/r*�:r+zxmlns:�)�getattr�_attrsr*r�document�createElementNS�
buildDocument�
createElement�items�createAttributeNS�setAttributeNodeNS�createAttribute�setAttributeNode�valuerrr)r�name�tagName�attrs�	xmlns_uri�xmlns_attrs�anamerAr/�	localnamer.�node�a_uri�a_localname�qname�attrs                r�startElementNSzPullDOM.startElementNS3s���3�	��d�N�D�9���"� +�
9���u�38����i��/�0�
9� "�D�����Y�����.�.�s�3���$�s�l�Y�6�G�'�G��}�}��}�}�4�4�S�'�B���)�)�#�w�7���}�}��}�}�2�2�9�=���)�)�$�	�:�� �;�;�=�	�K�E�%�!&��E�;��	�!��'�)�'�E�$�{�2�E��}�}�6�6�u�e�D���'�'��-���.�.�u�5���"�S�L�;�6�E�'�E��}�}�6�6�u�e�D���'�'��-��}�}�4�4�[�A���%�%�d�+��D�J�)	�,,�T�2�D�9����q������*����	�	�$�r#c�v�t|j�fdg|jd<|jd|_y�Nr5�rrr)rrBrCs   r�endElementNSzPullDOM.endElementNSl�0��)�4�8�8�:�6��=����q������*��r#c��|jr|jj|�}n|jd|�}|j�D]8\}}|jj	|�}||_|j
|��:t|fdg|jd<|jd|_|j|�yrP)
r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs       r�startElementzPullDOM.startElementps����=�=��=�=�.�.�t�4�D��%�%�d�D�1�D� �;�;�=�	(�K�E�%��=�=�0�0��7�D��D�J��!�!�$�'�	(�
,�T�2�D�9����q������*����	�	�$�r#c�v�t|j�fdg|jd<|jd|_yrPrQ)rrBs  r�
endElementzPullDOM.endElementrSr#c���|jrG|jj|�}t|fdg|jd<|jd|_yt|fdg}|jj|�yrP)r8�
createCommentrrrr)r�srI�events    r�commentzPullDOM.comment�sf���=�=��=�=�.�.�q�1�D�")�4��$� 7�D�N�N�1��!�^�^�A�.�D�N��q�\�4�(�E����&�&�u�-r#c��|jrH|jj||�}t|fdg|jd<|jd|_yt||fdg}|jj|�yrP)r8�createProcessingInstructionrrrr)r�target�datarIr[s     r�processingInstructionzPullDOM.processingInstruction�sl���=�=��=�=�<�<�V�T�J�D�"8�$�!?�� F�D�N�N�1��!�^�^�A�.�D�N�,�f�d�;�T�B�E����&�&�u�-r#c��|jj|�}t|fdg|jd<|jd|_yrP)r8�createTextNoder	r�r�charsrIs   r�ignorableWhitespacezPullDOM.ignorableWhitespace�s>���}�}�+�+�E�2��2�D�9�4�@����q������*��r#c��|jj|�}t|fdg|jd<|jd|_yrP)r8rcr
rrds   r�
characterszPullDOM.characters�s>���}�}�+�+�E�2��(�$�/��6����q������*��r#c��|j�4ddl}|jjjj
|_yy)Nr)r�xml.dom.minidom�dom�minidom�Document�implementation)rrs  r�
startDocumentzPullDOM.startDocument�s2�����'�"�#&�7�7�?�?�#;�#;�#J�#J�D� �(r#c�R�|jj||d�}||_t|fdg|jd<|jd|_|j|�|jD]�}|ddtk(r1|d\}}}|jj||�}t|f|d<nN|ddtk(r-|jj|dd�}t|f|d<ntd|dd��||jd<||_��d|_|jS)Nr5rzUnknown pending event )
r�createDocumentr8rrrrrr^rrY�AssertionError�
firstChild)	rr/�tagnamerI�e�_r_r`�ns	         rr:zPullDOM.buildDocument�s)���#�#�2�2�3���F����
�,�d�3�T�:����q������*����	�	�$���$�$�	�A���t�A�w�0�0� !�!��
��&���M�M�=�=�f�d�K��.��2��!���1��a��G�#��M�M�/�/��!��Q��8����|��!��$�%=�a��d�1�g�F�F� !�D�N�N�1���D�N�	�#������r#c�f�t|jfdg|jd<|j�yrP)rr8rr�rs r�endDocumentzPullDOM.endDocument�s'��*�D�M�M�:�D�A����q�����
r#c��d|_y)z.clear(): Explicitly release parsing structuresN)r8rys r�clearz
PullDOM.clear�s	����
r#r%)�__name__�
__module__�__qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|�r#rrr
sc���H��H�!� �
 �4�8�7�r+�
�+�.�.�+�
+�
K�
�0�r#rc��eZdZd�Zd�Zd�Zy)�ErrorHandlerc��t|�yr%)�print�r�	exceptions  r�warningzErrorHandler.warning�s
��
�i�r#c��|�r%r�r�s  r�errorzErrorHandler.error�����r#c��|�r%r�r�s  r�
fatalErrorzErrorHandler.fatalError�r�r#N)r}r~rr�r�r�r�r#rr�r��s����r#r�c�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�DOMEventStreamc��||_||_||_t|jd�s|j|_|j
�y)N�feed)�stream�parser�bufsizer,�_slurp�getEvent�reset)rr�r�r�s    rrzDOMEventStream.__init__�s9������������t�{�{�F�+� �K�K�D�M��
�
�r#c���t�|_|jjtj
jjd�|jj|j�yrP)	r�pulldomr��
setFeaturer�sax�handler�feature_namespaces�setContentHandlerrys rr�zDOMEventStream.reset�sC���y��������s�w�w���A�A�1�E����%�%�d�l�l�3r#c�6�|j�}|r|St�r%)r��
StopIteration�r�rcs  r�__next__zDOMEventStream.__next__�s��
�]�]�_��
��I��r#c��|Sr%r�rys r�__iter__zDOMEventStream.__iter__�s���r#c���|j�}|g}|rb|\}}||ury|tk7r|dj|�|tk(r|j	|�n|tk(r|d=|j�}|r�ayyr!)r�r�appendChildrr)rrIr[�parents�token�cur_nodes      r�
expandNodezDOMEventStream.expandNode�sx���
�
����&���#�O�E�8��4�����#����'�'��1��
�%����x�(��+�%��B�K��M�M�O�E�r#c�@�|jjds%|jj|j_|jjdsw|jj	|j
�}|s|jj�y|jj|�|jjds�w|jjdd}|jjdd|jjd<|S)Nr5r)	r�rrr��readr�r��closer�)r�bufr�s   rr�zDOMEventStream.getEvent�s����|�|�&�&�q�)�%)�\�\�%<�%<�D�L�L�"��,�,�)�)�!�,��+�+�"�"�4�<�<�0�C�����!�!�#���K�K���S�!��,�,�)�)�!�,��\�\�
$�
$�Q�
'��
*��%)�\�\�%<�%<�Q�%?��%B�������"��	r#c��|jj|j�|j|_|j�S)z� Fallback replacement for getEvent() using the
            standard SAX2 interface, which means we slurp the
            SAX events into memory (no performance gain, but
            we are compatible to all SAX parsers).
        )r��parser��_emitr�rys rr�zDOMEventStream._slurps1��	
�����$�+�+�&��
�
��
��z�z�|�r#c��|jjdd}|jjdd|jjd<|S)zn Fallback replacement for getEvent() that emits
            the events that _slurp() read previously.
        r5r)r�rr�s  rr�zDOMEventStream._emitsJ���\�\�
$�
$�Q�
'��
*��%)�\�\�%<�%<�Q�%?��%B�������"��	r#c�X�|jj�|`d|_d|_y)z+clear(): Explicitly release parsing objectsN)r�r|r�r�rys rr|zDOMEventStream.clears%���������L������r#N)r}r~rrr�r�r�r�r�r�r�r|r�r#rr�r��s/���4���
$�
���r#r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�SAX2DOMc��tj||||�|jd}|jd}|j|�y�Nr���)rrNrr�)rrBrCrD�curNode�
parentNodes      rrNzSAX2DOM.startElementNSsD�����t�T�7�E�:��#�#�B�'���&�&�r�*�
����w�'r#c��tj|||�|jd}|jd}|j|�yr�)rrUrr�)rrBrDr�r�s     rrUzSAX2DOM.startElement#sB�����T�4��/��#�#�B�'���&�&�r�*�
����w�'r#c��tj|||�|jdd}|jd}|j	|�y�Nrr5r)rrarrr�)rr_r`rIr�s     rrazSAX2DOM.processingInstruction)sE���%�%�d�F�D�9��~�~�a� ��#���&�&�r�*�
����t�$r#c��tj||�|jdd}|jd}|j	|�yr�)rrfrrr��rrerIr�s    rrfzSAX2DOM.ignorableWhitespace/sC���#�#�D�%�0��~�~�a� ��#���&�&�r�*�
����t�$r#c��tj||�|jdd}|jd}|j	|�yr�)rrhrrr�r�s    rrhzSAX2DOM.characters5sC�����4��'��~�~�a� ��#���&�&�r�*�
����t�$r#N)r}r~rrNrUrarfrhr�r#rr�r�s��(�(�%�%�%r#r�i�?c��|�t}t|t�r
t|d�}n|}|stj
j
�}t|||�S)N�rb)�default_bufsize�
isinstance�str�openrr��make_parserr�)�stream_or_stringr�r�r�s    rr�r�>sM����!���"�C�(��&��-��!������$�$�&���&�&�'�2�2r#c��ddlm}t|�}||�}|stjj�}t
|||�S)Nr)�StringIO)�ior��lenrr�r�r�)�stringr�r�r�r�s     r�parseStringr�Is<����&�k�G�
�6�
�C�����$�$�&���#�v�w�/�/r#)NNr%)�xml.saxr�xml.sax.handlerrrrrrrr	r
r��ContentHandlerrr�r�r�r�r�r�r�r#r�<module>r�s������
���
��!����1��-��
�
�u�c�g�g�$�$�u�n��M�M�^%�g�%�B!��	3�0r#

Zerion Mini Shell 1.0