Your IP : 3.145.161.199


Current Path : /opt/alt/python311/lib64/python3.11/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/xml/dom/__pycache__/pulldom.cpython-311.opt-2.pyc

�

c��fu-����ddlZddlZdZdZdZdZdZdZdZ	d	Z
Gd
�dejj��Z
Gd�d
��ZGd�d��ZGd�de
��ZdZdd�Zdd�ZdS)�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�ZdS)�PullDOMNc��ddlm}||_ddg|_|j|_g|_|jj|_	|jj|_n#t$rYnwxYw|dig|_
|j
d|_g|_dS)Nr)�
XML_NAMESPACE�xml���)
�xml.domr�documentFactory�
firstEvent�	lastEvent�elementStack�append�push�pop�AttributeError�_ns_contexts�_current_context�pending_events)�selfrrs   �6/opt/alt/python311/lib64/python3.11/xml/dom/pulldom.py�__init__zPullDOM.__init__s���)�)�)�)�)�)�.�����,�����������%�,��	�	��(�,�D�H�H���	�	�	��D�	����,�E�2�3��� $� 1�"� 5��� ����s�A�
A�Ac�0�|jd}|jd=|S�Nr)r)r�results  rrzPullDOM.pop!s���"�2�&����b�!��
�c��||_dS�N)�_locator)r�locators  r�setDocumentLocatorzPullDOM.setDocumentLocator&s
����
�
�
r#c���t|d��sg|_|j�|pd|f��|j�|j�����|pd|j|<dS)N�_xmlns_attrs�xmlns)�hasattrr*rrr�copy)r�prefix�uris   r�startPrefixMappingzPullDOM.startPrefixMapping)sz���t�^�,�,�	#� "�D���� � �&�"3�G�S�!9�:�:�:��� � ��!6�!;�!;�!=�!=�>�>�>�%+�^�t���c�"�"�"r#c�B�|j���|_dSr%)rrr)rr.s  r�endPrefixMappingzPullDOM.endPrefixMapping0s�� $� 1� 5� 5� 7� 7����r#c���d}t|dd��}|�|D]\}}||j||f<�g|_|\}}	|rV|�|j|}
|
r	|
dz|	z}n|	}|jr|j�||��}nO|�||��}n8|jr|j�|	��}n|�d|	��}|���D]�\}}|\}}
||kr?|
dkr|
}nd|
z}|j�	||��}|�
|��n||rK|j|}
|
r	|
dz|
z}n|
}|j�	||��}|�
|��n/|j�|
��}|�|��||_
��t|fdg|jd<|jd|_|�|��dS)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.startElementNS3sD��3�	��d�N�D�9�9���"� +�
9�
9���u�38���i��/�0�0� "�D�����Y��	;����.�s�3���(�$�s�l�Y�6�G�G�'�G��}�
8��}�4�4�S�'�B�B����)�)�#�w�7�7����}�
;��}�2�2�9�=�=����)�)�$�	�:�:�� �;�;�=�=�	�	�K�E�%�!&��E�;��	�!�!��'�)�)�'�E�E�$�{�2�E��}�6�6�u�e�D�D���'�'��-�-�-�-��

,��.�u�5���(�"�S�L�;�6�E�E�'�E��}�6�6�u�e�D�D���'�'��-�-�-�-��}�4�4�[�A�A���%�%�d�+�+�+��D�J�J�+�T�2�D�9���q�����*����	�	�$�����r#c�t�t|���fdg|jd<|jd|_dS�Nr5�rrr)rrBrCs   r�endElementNSzPullDOM.endElementNSl�2��)�4�8�8�:�:�6��=���q�����*����r#c��|jr|j�|��}n|�d|��}|���D];\}}|j�|��}||_|�|���<t|fdg|jd<|jd|_|�	|��dSrP)
r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs       r�startElementzPullDOM.startElementps����=�	2��=�.�.�t�4�4�D�D��%�%�d�D�1�1�D� �;�;�=�=�	(�	(�K�E�%��=�0�0��7�7�D��D�J��!�!�$�'�'�'�'�+�T�2�D�9���q�����*����	�	�$�����r#c�t�t|���fdg|jd<|jd|_dSrPrQ)rrBs  r�
endElementzPullDOM.endElementrSr#c���|jrA|j�|��}t|fdg|jd<|jd|_dSt|fdg}|j�|��dSrP)r8�
createCommentrrrr)r�srI�events    r�commentzPullDOM.comment�ss���=�	.��=�.�.�q�1�1�D�")�4��$� 7�D�N�1��!�^�A�.�D�N�N�N��q�\�4�(�E���&�&�u�-�-�-�-�-r#c���|jrB|j�||��}t|fdg|jd<|jd|_dSt||fdg}|j�|��dSrP)r8�createProcessingInstructionrrrr)r�target�datarIr[s     r�processingInstructionzPullDOM.processingInstruction�sy���=�	.��=�<�<�V�T�J�J�D�"8�$�!?�� F�D�N�1��!�^�A�.�D�N�N�N�,�f�d�;�T�B�E���&�&�u�-�-�-�-�-r#c��|j�|��}t|fdg|jd<|jd|_dSrP)r8�createTextNoder	r�r�charsrIs   r�ignorableWhitespacezPullDOM.ignorableWhitespace�s?���}�+�+�E�2�2��2�D�9�4�@���q�����*����r#c��|j�|��}t|fdg|jd<|jd|_dSrP)r8rcr
rrds   r�
characterszPullDOM.characters�s?���}�+�+�E�2�2��(�$�/��6���q�����*����r#c�V�|j�!ddl}|jjjj|_dSdS)Nr)r�xml.dom.minidom�dom�minidom�Document�implementation)rrs  r�
startDocumentzPullDOM.startDocument�s7����'�"�"�"�"�#&�7�?�#;�#J�D� � � �(�'r#c�p�|j�||d��}||_t|fdg|jd<|jd|_|�|��|jD]�}|ddtkr4|d\}}}|j�||��}t|f|d<nf|ddtkr3|j�
|dd��}t|f|d<ntd|dd���||jd<||_��d|_|jS)Nr5rzUnknown pending event )
r�createDocumentr8rrrrrr^rrY�AssertionError�
firstChild)	rr/�tagnamerI�e�_r_r`�ns	         rr:zPullDOM.buildDocument�s1���#�2�2�3���F�F����
�,�d�3�T�:���q�����*����	�	�$�����$�	�	�A���t�A�w�0�0�0� !�!��
��&���M�=�=�f�d�K�K��.��2��!����1��a��G�#�#��M�/�/��!��Q��8�8����|��!���$�%=�a��d�1�g�F�F�F� !�D�N�1���D�N�N�"�����r#c�^�t|jfdg|jd<|���dSrP)rr8rr�rs r�endDocumentzPullDOM.endDocument�s+��*�D�M�:�D�A���q�����
�
�
�
�
r#c��	d|_dSr%)r8rys r�clearz
PullDOM.clear�s��8���
�
�
r#r%)�__name__�
__module__�__qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|�r#rrr
s&�������H��H�!�!�!�!� ���
 � � �4�4�4�8�8�8�7�7�7�r+�+�+�
�
�
�+�+�+�.�.�.�.�.�.�+�+�+�
+�+�+�
K�K�K�
���0�������r#rc� �eZdZd�Zd�Zd�ZdS)�ErrorHandlerc�$�t|��dSr%)�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��sA����������������r#r�c�D�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�DOMEventStreamc��||_||_||_t|jd��s|j|_|���dS)N�feed)�stream�parser�bufsizer,�_slurp�getEvent�reset)rr�r�r�s    rrzDOMEventStream.__init__�sE������������t�{�F�+�+�	(� �K�D�M��
�
�����r#c���t��|_|j�tjjjd��|j�|j��dSrP)	r�pulldomr��
setFeaturer�sax�handler�feature_namespaces�setContentHandlerrys rr�zDOMEventStream.reset�sJ���y�y�������s�w��A�1�E�E�E���%�%�d�l�3�3�3�3�3r#c�@�|���}|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�(�|���}|g}|rx|\}}||urdS|tkr|d�|��|tkr|�|��n|tkr|d=|���}|�vdSdSr!)r�r�appendChildrr)rrIr[�parents�token�cur_nodes      r�
expandNodezDOMEventStream.expandNode�s����
�
�����&���
	$�#�O�E�8��4�������#�#����'�'��1�1�1��
�%�%����x�(�(�(�(��+�%�%��B�K��M�M�O�O�E��
	$�
	$�
	$�
	$�
	$r#c���|jjds|jj|j_|jjdsh|j�|j��}|s|j���dS|j�|��|jjd�h|jjdd}|jjdd|jjd<|S�Nr5r)	r�rrr��readr�r��closer�)r�bufr�s   rr�zDOMEventStream.getEvent�s����|�&�q�)�	=�%)�\�%<�D�L�"��,�)�!�,�	"��+�"�"�4�<�0�0�C��
���!�!�#�#�#��t��K���S�!�!�!��,�)�!�,�	"��\�
$�Q�
'��
*��%)�\�%<�Q�%?��%B�����"��	r#c��	|j�|j��|j|_|���Sr%)r��parser��_emitr�rys rr�zDOMEventStream._slurps8��	�
	
����$�+�&�&�&��
��
��z�z�|�|�r#c��	|jjdd}|jjdd|jjd<|Sr�)r�rr�s  rr�zDOMEventStream._emits@��	��\�
$�Q�
'��
*��%)�\�%<�Q�%?��%B�����"��	r#c�Z�	|j���|`d|_d|_dSr%)r�r|r�r�rys rr|zDOMEventStream.clears0��9���������L��������r#N)r}r~rrr�r�r�r�r�r�r�r|r�r#rr�r��s����������4�4�4�������
$�
$�
$�
�
�
�����������r#r�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�SAX2DOMc��t�||||��|jd}|jd}|�|��dS�Nr���)rrNrr�)rrBrCrD�curNode�
parentNodes      rrNzSAX2DOM.startElementNSsP�����t�T�7�E�:�:�:��#�B�'���&�r�*�
����w�'�'�'�'�'r#c��t�|||��|jd}|jd}|�|��dSr�)rrUrr�)rrBrDr�r�s     rrUzSAX2DOM.startElement#sN�����T�4��/�/�/��#�B�'���&�r�*�
����w�'�'�'�'�'r#c��t�|||��|jdd}|jd}|�|��dS�Nrr5r)rrarrr�)rr_r`rIr�s     rrazSAX2DOM.processingInstruction)sR���%�%�d�F�D�9�9�9��~�a� ��#���&�r�*�
����t�$�$�$�$�$r#c��t�||��|jdd}|jd}|�|��dSr�)rrfrrr��rrerIr�s    rrfzSAX2DOM.ignorableWhitespace/sP���#�#�D�%�0�0�0��~�a� ��#���&�r�*�
����t�$�$�$�$�$r#c��t�||��|jdd}|jd}|�|��dSr�)rrhrrr�r�s    rrhzSAX2DOM.characters5sP�����4��'�'�'��~�a� ��#���&�r�*�
����t�$�$�$�$�$r#N)r}r~rrNrUrarfrhr�r#rr�r�s_������(�(�(�(�(�(�%�%�%�%�%�%�%�%�%�%�%r#r�i�?c���|�t}t|t��rt|d��}n|}|stj���}t|||��S)N�rb)�default_bufsize�
isinstance�str�openrr��make_parserr�)�stream_or_stringr�r�r�s    rr�r�>sc����!���"�C�(�(�"��&��-�-���!���'���$�$�&�&���&�&�'�2�2�2r#c��ddlm}t|��}||��}|stj���}t
|||��S)Nr)�StringIO)�ior��lenrr�r�r�)�stringr�r�r�r�s     r�parseStringr�Is[���������&�k�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�s9�����������
���
��!����1��-��
�
�u�u�u�u�u�c�g�$�u�u�u�n��������M�M�M�M�M�M�M�M�^%�%�%�%�%�g�%�%�%�B!��	3�	3�	3�	3�0�0�0�0�0�0r#

?>