Your IP : 18.225.117.89


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

�

c��f�"���	gd�ZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZGd�de��Z
d�ZGd	�d
��Zifd�ZdCd�ZdCd
�ZeZGd�d��ZGd�d��Zejd���ZdCd�Zd�Zhd�Zd�Zd�Zeeed�Zd�Zddddddd d!�Zee_d"�Z d#�Z!d$�Z"d%�Z#dDddd&d'�d(�Z$Gd)�d*ej%��Z&dDddd&d'�d+�Z'd,�Z(dEd.�Z)dCd/�Z*dDd0�Z+Gd1�d2��Z,dCd3�Z-dCd4�Z.e-Z/dCd5�Z0Gd6�d7��Z1Gd8�d9��Z2dCddd:�d;�Z3ej4d<ej5��j6Z7Gd=�d>��Z8d?�Z9d@�Z:	eZ;ddAl<TddBl<m=Z=e=ee��dS#e>$rYdSwxYw)F)�Comment�dump�Element�ElementTree�
fromstring�fromstringlist�indent�	iselement�	iterparse�parse�
ParseError�PI�ProcessingInstruction�QName�
SubElement�tostring�tostringlist�TreeBuilder�VERSION�XML�XMLID�	XMLParser�
XMLPullParser�register_namespace�canonicalize�C14NWriterTargetz1.3.0�N�)�ElementPathc��eZdZ	dS)rN)�__name__�
__module__�__qualname__���</opt/alt/python311/lib64/python3.11/xml/etree/ElementTree.pyrrks�������	�Dr$rc�$�	t|d��S)N�tag)�hasattr)�elements r%r	r	ys��<��7�E�"�"�"r$c���eZdZ	dZ	dZ	dZ	dZ	ifd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zdd�Zdd�Zdd�Zdd�Zd�Zdd�Zd�Zd�Zd�Zdd�Zd�Z dS)rNc��t|t��std|jj�����||_i|�|�|_g|_dS)Nzattrib must be dict, not )�
isinstance�dict�	TypeError�	__class__r r'�attrib�	_children)�selfr'r0�extras    r%�__init__zElement.__init__�s\���&�$�'�'�	-��)�� �)�)�,�-�-�
-����)��)�5�)�������r$c�J�d|jj|jt|��fzS)Nz<%s %r at %#x>)r/r r'�id�r2s r%�__repr__zElement.__repr__�s!���4�>�#:�D�H�b��h�h�"O�O�Or$c�0�	|�||��S�N)r/)r2r'r0s   r%�makeelementzElement.makeelement�s��	��~�~�c�6�*�*�*r$c�`�	tjdt��|���S)Nz7elem.copy() is deprecated. Use copy.copy(elem) instead.)�warnings�warn�DeprecationWarning�__copy__r7s r%�copyzElement.copy�s3��	�	�
�E��	�	�	��}�}���r$c��|�|j|j��}|j|_|j|_||dd�<|Sr:)r;r'r0�text�tail)r2�elems  r%r@zElement.__copy__�s?�������$�+�6�6���I��	��I��	���Q�Q�Q���r$c�*�t|j��Sr:)�lenr1r7s r%�__len__zElement.__len__�s���4�>�"�"�"r$c�j�tjdtd���t|j��dkS)NzyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.���
stacklevelr)r=r>�
FutureWarningrGr1r7s r%�__bool__zElement.__bool__�s=���
�
K��a�	�	�	�	�
�4�>�"�"�a�'�'r$c��|j|Sr:�r1�r2�indexs  r%�__getitem__zElement.__getitem__�s���~�e�$�$r$c��t|t��r|D]}|�|���n|�|��||j|<dSr:)r,�slice�_assert_is_elementr1)r2rRr)�elts    r%�__setitem__zElement.__setitem__�sg���e�U�#�#�	-��
-�
-���'�'��,�,�,�,�
-�
�#�#�G�,�,�,� '���u���r$c��|j|=dSr:rPrQs  r%�__delitem__zElement.__delitem__�s���N�5�!�!�!r$c�f�	|�|��|j�|��dSr:�rVr1�append�r2�
subelements  r%r]zElement.append�s9��	�	
���
�+�+�+�����j�)�)�)�)�)r$c�p�	|D]1}|�|��|j�|���2dSr:r\)r2�elementsr)s   r%�extendzElement.extend�sO��	�
 �	+�	+�G��#�#�G�,�,�,��N�!�!�'�*�*�*�*�	+�	+r$c�h�	|�|��|j�||��dSr:)rVr1�insert)r2rRr_s   r%rdzElement.inserts7��6����
�+�+�+�����e�Z�0�0�0�0�0r$c�x�t|t��s$tdt|��jz���dS)Nzexpected an Element, not %s)r,�_Element_Pyr.�typer )r2�es  r%rVzElement._assert_is_elements@���!�[�)�)�	N��9�D��G�G�<L�L�M�M�M�	N�	Nr$c�<�	|j�|��dSr:)r1�remover^s  r%rjzElement.remove
s%��
	�	
����j�)�)�)�)�)r$c�0�	tj|||��Sr:)r�find�r2�path�
namespacess   r%rlzElement.finds��	����d�J�7�7�7r$c�2�	tj||||��Sr:)r�findtext�r2rn�defaultros    r%rqzElement.findtext's ��
	��#�D�$���D�D�Dr$c�0�	tj|||��Sr:)r�findallrms   r%ruzElement.findall5s��	��"�4��z�:�:�:r$c�0�	tj|||��Sr:)r�iterfindrms   r%rwzElement.iterfind@s��	��#�D�$�
�;�;�;r$c�d�	|j���g|_dx|_|_dSr:)r0�clearr1rCrDr7s r%ryz
Element.clearKs6��	�	
���������� $�$��	�D�I�I�Ir$c�:�	|j�||��Sr:)r0�get)r2�keyrss   r%r{zElement.getVs��		��{���s�G�,�,�,r$c��	||j|<dSr:)r0)r2r|�values   r%�setzElement.setcs��	�!���C���r$c�6�	|j���Sr:)r0�keysr7s r%r�zElement.keysms��	��{���!�!�!r$c�6�	|j���Sr:)r0�itemsr7s r%r�z
Element.itemsvs��	��{� � �"�"�"r$c#�K�	|dkrd}|�|j|kr|V�|jD]}|�|��Ed{V���dS)N�*)r'r1�iter)r2r'rhs   r%r�zElement.iter�ss����
	��#�:�:��C��;�$�(�c�/�/��J�J�J���	#�	#�A��v�v�c�{�{�"�"�"�"�"�"�"�"�	#�	#r$c#�K�	|j}t|t��s|�dS|j}|r|V�|D])}|���Ed{V��|j}|r|V��*dSr:)r'r,�strrC�itertextrD)r2r'�trhs    r%r�zElement.itertext�s�����	��h���#�s�#�#�	����F��I���	��G�G�G��	�	�A��z�z�|�|�#�#�#�#�#�#�#���A��
������		�	r$r:�NN)!r r!r"r'r0rCrDr4r8r;rAr@rHrNrSrXrZr]rbrdrVrjrlrqrurwryr{rr�r�r�r�r#r$r%rr~s��������(�C��
�F�1��D���D��$&�����P�P�P�	+�	+�	+�������#�#�#�(�(�(�%�%�%�(�(�(�"�"�"�	*�	*�	*�+�+�+�1�1�1�
N�N�N�
*�
*�
*�	8�	8�	8�	8�E�E�E�E�	;�	;�	;�	;�	<�	<�	<�	<�	%�	%�	%�-�-�-�-�!�!�!�"�"�"�	#�	#�	#�#�#�#�#�,����r$rc�j�	i|�|�}|�||��}|�|��|Sr:)r;r])�parentr'r0r3r)s     r%rr�sD��
�!��
 �%�
 �F�� � ��f�-�-�G�
�M�M�'�����Nr$c�>�	tt��}||_|Sr:)rrrC)rCr)s  r%rr�s"����g���G��G�L��Nr$c�f�	tt��}||_|r|jdz|z|_|S)N� )rrrC)�targetrCr)s   r%rr�s>����+�,�,�G��G�L��1��|�c�)�D�0����Nr$c�H�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�ZdS)rNc�(�|rd|�d|��}||_dS)N�{�}�rC)r2�text_or_urir's   r%r4zQName.__init__�s*���	8�	8�&1�k�k�3�3�7�K���	�	�	r$c��|jSr:r�r7s r%�__str__z
QName.__str__�s
���y�r$c�2�d|jj�d|j�d�S)N�<r��>)r/r rCr7s r%r8zQName.__repr__�s ��� �N�3�3�3�T�Y�Y�Y�?�?r$c�*�t|j��Sr:)�hashrCr7s r%�__hash__zQName.__hash__�s���D�I���r$c�b�t|t��r|j|jkS|j|kSr:�r,rrC�r2�others  r%�__le__zQName.__le__��0���e�U�#�#�	+��9��
�*�*��y�E�!�!r$c�b�t|t��r|j|jkS|j|kSr:r�r�s  r%�__lt__zQName.__lt__��0���e�U�#�#�	*��9�u�z�)�)��y�5� � r$c�b�t|t��r|j|jkS|j|kSr:r�r�s  r%�__ge__zQName.__ge__�r�r$c�b�t|t��r|j|jkS|j|kSr:r�r�s  r%�__gt__zQName.__gt__r�r$c�b�t|t��r|j|jkS|j|kSr:r�r�s  r%�__eq__zQName.__eq__r�r$r:)r r!r"r4r�r8r�r�r�r�r�r�r#r$r%rr�s�������� � � � ����@�@�@����"�"�"�!�!�!�"�"�"�!�!�!�"�"�"�"�"r$rc�p�eZdZ	dd�Zd�Zd�Zdd�Zdd�Zdd�Zdd�Z	dd	�Z
dd
�Z				ddd�d
�Zd�Z
dS)rNc�F�||_|r|�|��dSdSr:)�_rootr)r2r)�files   r%r4zElementTree.__init__s3����
��	��J�J�t������	�	r$c��	|jSr:�r�r7s r%�getrootzElementTree.getroots
��/��z�r$c��	||_dSr:r�)r2r)s  r%�_setrootzElementTree._setroot#s��	���
�
�
r$c��	d}t|d��st|d��}d}	|�Vt��}t|d��r8|�|��|_|j|r|���SS	|�d��}|sn|�|���.|���|_|j|r|���SS#|r|���wwxYw)NF�read�rbT�_parse_wholei)r(�openrr�r��closer��feed)r2�source�parser�close_source�datas     r%rzElementTree.parse-s��		����v�v�&�&�	 ��&�$�'�'�F��L�	��~�"�����6�>�2�2�&�
"(�!4�!4�V�!<�!<�D�J��:��
��������
�
"��{�{�5�)�)��������D�!�!�!�	
"�
 �����D�J��:��
��������
��|�
��������
���s�AC%�?AC%�%C>c�8�	|j�|��Sr:)r�r��r2r's  r%r�zElementTree.iterRs��	��z���s�#�#�#r$c��	|dd�dkr$d|z}tjd|ztd���|j�||��S�Nr�/�.z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rrJrK)r=r>rMr�rlrms   r%rlzElementTree.find^sh��		�����8�s�?�?���:�D��M�-�/3�4��!�	
�
�
�
��z���t�Z�0�0�0r$c��	|dd�dkr$d|z}tjd|ztd���|j�|||��Sr�)r=r>rMr�rqrrs    r%rqzElementTree.findtexttsl��		�����8�s�?�?���:�D��M�-�/3�4��!�	
�
�
�
��z�"�"�4��*�=�=�=r$c��	|dd�dkr$d|z}tjd|ztd���|j�||��Sr�)r=r>rMr�rurms   r%ruzElementTree.findall�sj��		�����8�s�?�?���:�D��M�-�/3�4��!�	
�
�
�
��z�!�!�$�
�3�3�3r$c��	|dd�dkr$d|z}tjd|ztd���|j�||��Sr�)r=r>rMr�rwrms   r%rwzElementTree.iterfind�sj��		�����8�s�?�?���:�D��M�-�/3�4��!�	
�
�
�
��z�"�"�4��4�4�4r$T��short_empty_elementsc���	|sd}n|tvrtd|z���|s|dkrd}nd}t||��5\}}|dkrA|s0|�=|���dkr%|���dvr|d|�d	���|d
krt	||j��n:t
|j|��\}	}
t|}|||j|	|
|���ddd��dS#1swxYwYdS)N�xmlzunknown method %r�c14n�utf-8�us-ascii�unicode)r�r�z<?xml version='1.0' encoding='z'?>
rCr�)�
_serialize�
ValueError�_get_writer�lower�_serialize_textr��_namespaces)r2�file_or_filename�encoding�xml_declaration�default_namespace�methodr��write�declared_encoding�qnamesro�	serializes            r%r�zElementTree.write�s���	�.�	;��F�F�
�:�
%�
%��0�6�9�:�:�:��	&�����"���%��
�)�8�
4�
4�
	E�8R��@Q�����O��$�,��^�^�%�%��2�2�&�,�,�.�.�6K�K�K����%�%�%�(�)�)�)�������t�z�2�2�2�2�%0���=N�%O�%O�"��
�&�v�.�	��	�%���V�Z�/C�E�E�E�E�
	E�
	E�
	E�
	E�
	E�
	E�
	E�
	E�
	E�
	E�
	E�
	E����
	E�
	E�
	E�
	E�
	E�
	Es�B!C-�-C1�4C1c�0�|�|d���S)Nr�)r�)r�)r2r�s  r%�
write_c14nzElementTree.write_c14n�s���z�z�$�v�z�.�.�.r$r�r:)NNNN)r r!r"r4r�r�rr�rlrqrurwr�r�r#r$r%rrs������	�����������#�#�#�#�J
$�
$�
$�
$�1�1�1�1�,>�>�>�>�,4�4�4�4�,5�5�5�5�.�"� $��	3E�
$(�3E�3E�3E�3E�3E�j/�/�/�/�/r$rc#�xK�	|j}|���dkr|t|dd��pdfV�dStj��5}t|tj��r|}n�t|tj��r/t
j	|��}|�
|j��nLt
j��}d�|_||_	|j
|_
|j|_n#t$rYnwxYwt
j||dd���}|�
|j��|j|fV�ddd��dS#1swxYwYdS#t$rV|���dkrd}t#|d|d�	��5}|j|fV�ddd��YdS#1swxYwYYdSwxYw)
Nr�r�r�c��dS�NTr#r#r$r%�<lambda>z_get_writer.<locals>.<lambda>s��D�r$�xmlcharrefreplace�
)r��errors�newline�w)r�r�)r�r��getattr�
contextlib�	ExitStackr,�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�AttributeError�
TextIOWrapperr�)r�r�r��stackr�s     r%r�r��s�����-+� �&���>�>���y�(�(���!1�:�t�D�D�O��O�O�O�O�O�O��%�'�'�
+�5��.��0A�B�B��+�D�D�� 0�"�,�?�?���,�-=�>�>�D��N�N�4�;�/�/�/�/��,�.�.�D�$0�L�D�M�!&�D�J��)9�(A��
�$4�$9��	�	��)�����������'��19�/B�04�6�6�6�����t�{�+�+�+��j�(�*�*�*�*�9
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+�
+�
+���'�'�'��>�>���y�(�(��H�
�"�C�(�,�.�.�.�	'�15��*�h�&�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	'�	'�	'�	'���sm�E�B	E�C2�1E�2
C?�<E�>C?�?AE�E�E�7F9�F*�F9�*F.	�.F9�1F.	�2F9�8F9c�����ddi�i��rd��<���fd�}|���D�])}|j}t|t��r|j�vr||j��nHt|t
��r|�vr||��n#|�!|tur|turt|��|�	��D]^\}}t|t��r|j}|�vr||��t|t��r|j�vr||j���_|j}t|t��r|j�vr||j����+��fS)N�c���	|dd�dkr�|dd��dd��\}}��|��}|�9t�|��}|�dt���z}|dkr|�|<|r|�d|���|<dS|�|<dS�rt	d���|�|<dS#t
$rt
|��YdSwxYw)Nrr�r�zns%dr��:z<cannot use non-qualified names with default_namespace option)�rsplitr{�_namespace_maprGr�r.�_raise_serialization_error)�qname�urir'�prefixr�ror�s    ���r%�	add_qnamez_namespaces.<locals>.add_qname/s���	.��R�a�R�y�C��� ����9�+�+�C��3�3���S�#����,�,���>�+�/�/��4�4�F��~�!'�#�j�/�/�!9������*0�
�3���(�/5�v�v�s�s�$;�F�5�M�M�M�$'�F�5�M�M�M�$��$�3����!&��u�
�
�
���	.�	.�	.�&�u�-�-�-�-�-�-�	.���s�BB/�B/�B/�/C�C)
r�r'r,rrCr�rr
rr�)	rEr�rr'r|r~rCror�s	 `     @@r%r�r�$s�������D�\�F��J��+�(*�
�$�%�.�.�.�.�.�.�.�8�	�	���!�!���h���c�5�!�!�	,��x�v�%�%��	�#�(�#�#�#��
��S�
!�
!�	,��&� � ��	�#�����
�_��G�!3�!3��2�
�
�&�s�+�+�+��*�*�,�,�	&�	&�J�C���#�u�%�%�
��h���&� � ��	�#�����%��'�'�
&�E�J�f�,D�,D��	�%�*�%�%�%���y���d�E�"�"�	!�t�y��'>�'>��I�d�i� � � ���:��r$c	��|j}|j}|tur|d|z���n�|tur|d|z���n�||}|�5|r|t	|����|D]}t|||d|�����na|d|z��t
|�����}	|	s|r�|rPt|���d����D]+\}
}|rd|z}|d|�d	t|
���d
����,|	D]k\}}
t|t��r|j}t|
t��r||
j}
nt|
��}
|d||�d	|
�d
����l|st|��s|sP|d��|r|t	|����|D]}t|||d|����|d
|zdz��n|d��|j
r|t	|j
����dSdS)N�	<!--%s-->�<?%s?>r�r�c��|dS�Nrr#��xs r%r�z _serialize_xml.<locals>.<lambda>w�
��Q�q�T�r$�r|r� xmlns�="�"r�r��</z />)r'rCrr�
_escape_cdata�_serialize_xml�listr��sorted�_escape_attribr,rrGrD)r�rEr�ror��kwargsr'rCrhr��v�ks            r%rras���
�(�C��9�D�
�g�~�~�
��k�D� �!�!�!�!�	�%�	%�	%�
��h��o������S�k���;��
+���m�D�)�)�*�*�*��
J�
J���u�a���4H�J�J�J�J�J�
J�
�E�#��)����������&�&�E��
9�
�
9��� &�z�'7�'7�'9�'9�+9�>�!;�!;�!;�����1��(� #�a��A�����A�A�*�1�-�-�-�-������"�9�9�D�A�q�!�!�U�+�+�#��F��!�!�U�+�+�.�"�1�6�N���*�1�-�-���E�E�&��)�)�)�Q�Q�Q�7�8�8�8�8��	
�s�4�y�y�	
�(<�	
���c�
�
�
��/��E�-��-�-�.�.�.��N�N�A�"�5�!�V�T�8L�N�N�N�N�N���d�S�j�3�&�'�'�'�'���e�����y�(�
��m�D�I�&�&�'�'�'�'�'�(�(r$>�br�hr�col�img�wbr�area�base�link�meta�embed�frame�input�param�trackr��isindex�basefontc	�j�|j}|j}|tur|dt|��z���n�|tur|dt|��z���n�||}|�3|r|t|����|D]}t|||d����nu|d|z��t
|�����}|s|r�|rPt|���d����D]+\}	}
|
rd|
z}
|d|
�dt|	���d	����,|D]k\}
}	t|
t��r|
j}
t|	t��r||	j}	nt|	��}	|d
||
�d|	�d	����l|d��|�
��}|r0|dks|d
kr||��n|t|����|D]}t|||d���|tvr|d|zdz��|jr|t|j����dSdS)Nr	r
r�c��|dSrr#r
s r%r�z!_serialize_html.<locals>.<lambda>�rr$rrrrrr�r��script�styler)r'rCrrr�_serialize_htmlrr�rrr,r�_escape_attrib_htmlr��
HTML_EMPTYrD)r�rEr�rorr'rCrhr�rr�ltags            r%r1r1�s���
�(�C��9�D�
�g�~�~�
��k�M�$�/�/�/�0�0�0�0�	�%�	%�	%�
��h��t�,�,�,�-�-�-�-��S�k���;��
+���m�D�)�)�*�*�*��
8�
8����q�&�$�7�7�7�7�
8�
�E�#��)����������&�&�E��
9�
�
9��� &�z�'7�'7�'9�'9�+9�>�!;�!;�!;�����1��(� #�a��A�����A�A�*�1�-�-�-�-������"�9�9�D�A�q�!�!�U�+�+�#��F��!�!�U�+�+�3�"�1�6�N���/��2�2���E�E�&��)�)�)�Q�Q�Q�7�8�8�8�8��E�#�J�J�J��9�9�;�;�D��
/��8�#�#�t�w����E�$�K�K�K�K��E�-��-�-�.�.�.��
8�
8����q�&�$�7�7�7�7��:�%�%���d�S�j�3�&�'�'�'��y�(�
��m�D�I�&�&�'�'�'�'�'�(�(r$c�|�|���D]
}||���|jr||j��dSdSr:)r�rD)r�rE�parts   r%r�r��sT���
�
������
��d������y��
��d�i�������r$)r��htmlrCc���	tjd|��rtd���tt�����D]\}}||ks||krt|=�|t|<dS)Nzns\d+$z'Prefix format reserved for internal use)�re�matchr�rrr�)rrrrs    r%rr�s~��
�
�x�	�6�"�"�D��B�C�C�C��^�)�)�+�+�,�,�"�"���1���8�8�q�F�{�{��q�!�� �N�3���r$r�r7�rdf�wsdl�xs�xsi�dc)�$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/c�R�td|�dt|��j�d����)Nzcannot serialize z (type �))r.rgr r�s r%rr�s1��
�)�+/�4�4��d���1D�1D�1D�E�
�
�
r$c���	d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}|S#ttf$rt|��YdSwxYw)N�&�&amp;r��&lt;r��&gt;��replacer.r�rr�s r%rr�s���)��$�;�;��<�<��W�-�-�D��$�;�;��<�<��V�,�,�D��$�;�;��<�<��V�,�,�D�����~�&�)�)�)�"�4�(�(�(�(�(�(�)�����AA� A6�5A6c���	d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}d	|vr|�d	d
��}d|vr|�dd��}d
|vr|�d
d��}|S#ttf$rt|��YdSwxYw)NrDrEr�rFr�rGr�&quot;�
z&#13;r�z&#10;�	z&#09;rHr�s r%rrs	��)��$�;�;��<�<��W�-�-�D��$�;�;��<�<��V�,�,�D��$�;�;��<�<��V�,�,�D��4�<�<��<�<��h�/�/�D��4�<�<��<�<��g�.�.�D��4�<�<��<�<��g�.�.�D��4�<�<��<�<��g�.�.�D�����~�&�)�)�)�"�4�(�(�(�(�(�(�)���s�B7B:�: C�Cc���	d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}|S#ttf$rt|��YdSwxYw)NrDrEr�rGrrLrHr�s r%r2r2+s���	)��$�;�;��<�<��W�-�-�D��$�;�;��<�<��V�,�,�D��4�<�<��<�<��h�/�/�D�����~�&�)�)�)�"�4�(�(�(�(�(�(�)���rJT)r�r�r�c���	|dkrtj��ntj��}t|���||||||���|���S)Nr��r�r�r�r�)r��StringIO�BytesIOrr��getvalue)r)r�r�r�r�r��streams       r%rr:sr���'�)�3�3�R�[�]�]�]�����F�������v�x�/>�1B�&,�4H�	�J�J�J�
�?�?���r$c�.�eZdZ	d�Zd�Zd�Zd�Zd�ZdS)�_ListDataStreamc��||_dSr:)�lst)r2rYs  r%r4z_ListDataStream.__init__Ts
������r$c��dSr�r#r7s r%r�z_ListDataStream.writableW����tr$c��dSr�r#r7s r%r�z_ListDataStream.seekableZr[r$c�:�|j�|��dSr:)rYr])r2�bs  r%r�z_ListDataStream.write]s�����������r$c�*�t|j��Sr:)rGrYr7s r%r�z_ListDataStream.tell`s���4�8�}�}�r$N)r r!r"r4r�r�r�r�r#r$r%rWrWRsb������A�����������������r$rWc�x�g}t|��}t|���||||||���|S)NrQ)rWrr�)r)r�r�r�r�r�rYrUs        r%rrcsU��
�C�
�S�
!�
!�F�������v�x�/>�1B�&,�4H�	�J�J�J�
�Jr$c�"�	t|t��st|��}|�tjd���|���j}|r|ddkr!tj�d��dSdS)Nr�)r����r�)r,rr��sys�stdoutr�rD)rErDs  r%rrps�����d�K�(�(�!��4� � ���J�J�s�z�I�J�.�.�.��<�<�>�>��D���4��8�t�#�#��
���������$�#r$�  c������	t|t��r|���}|dkrtd|�����t	|��sdSd|�zzg����fd���|d��dS)Nrz,Initial indentation level must be >= 0, got r�c���|dz}	�|}n0#t$r#�|�z}��|��YnwxYw|jr|j���s||_|D]D}t	|��r�||��|jr|j���s||_�E|j���s�||_dSdSr)�
IndexErrorr]rC�striprGrD)rE�level�child_level�child_indentation�child�_indent_children�indentations�spaces     ���r%rnz indent.<locals>._indent_children�s����a�i��	3� ,�[� 9�����	3�	3�	3� ,�U� 3�e� ;����� 1�2�2�2�2�2�	3�����y�	*��	��� 1� 1�	*�)�D�I��	/�	/�E��5�z�z�
5� � ���4�4�4��:�
/�U�Z�%5�%5�%7�%7�
/�.��
���z���!�!�	-�%�e�,�E�J�J�J�	-�	-s��*>�>)r,rr�r�rG)�treerprjrnros ` @@r%rr�s������
��$��$�$���|�|�~�~���q�y�y��O��O�O�P�P�P��t�9�9�����5�5�=�(�)�L�-�-�-�-�-�-�-�,��T�1�����r$c�P�	t��}|�||��|Sr:)rr)r�r�rqs   r%rr�s+����=�=�D��J�J�v�v�����Kr$c�������	t||����t�d��st�d���d�nd����fd��G���fd�dtjj��}|��}d|_tj|���|S)	N)�events�_parserr�r�TFc3��K�		����Ed{V��|�d��}|sn��|���H����}����Ed{V�����}|�||_�r|���dSdS#�r|���wwxYw)NTi@)�read_eventsr�r��_close_and_return_root�rootr�)r�r�ry�itr��
pullparser�wrs    ���r%�iteratorziterparse.<locals>.iterator�s������	�
&�%�1�1�3�3�3�3�3�3�3�3�3��{�{�9�-�-���������%�%�%�

&��4�4�6�6�D�!�-�-�/�/�/�/�/�/�/�/�/�����B��~�����
���������
�
��|�
��������
���s�B
B)�)Cc�<��eZdZ����jZ��fd�ZdS)�$iterparse.<locals>.IterParseIteratorc�8���r����dSdSr:)r�)r2r�r�s ��r%�__del__z,iterparse.<locals>.IterParseIterator.__del__�s&����
���������
�
r$N)r r!r"�__next__r�)r�r}r�s���r%�IterParseIteratorr�sE��������8�F�#�#�,��	�	�	�	�	�	�	�	r$r�)	rr(r��collections�abc�Iteratorry�weakref�ref)	r�rtr�r�rzr�r}r{r|s	`    @@@@r%r
r
�s��������
� �f�f�=�=�=�J��6�6�"�"���f�d�#�#��������������$���������K�O�4����
�	�	�	�B��B�G�	��R���B�
�Ir$c�:�eZdZd	dd�d�Zd�Zd�Zd�Zd�Zd�ZdS)
rN)ruc���tj��|_|ptt	�����|_|�d}|j�|j|��dS)N�r�)�end)r��deque�
_events_queuerrru�
_setevents)r2rtrus   r%r4zXMLPullParser.__init__s[��
)�.�0�0����A�)�;�=�=�"A�"A�"A����>��F������ 2�F�;�;�;�;�;r$c���	|j�td���|rO	|j�|��dS#t$r%}|j�|��Yd}~dSd}~wwxYwdS)Nz!feed() called after end of stream)rur�r��SyntaxErrorr�r])r2r��excs   r%r�zXMLPullParser.feed
s���*��<���@�A�A�A��	/�
/���!�!�$�'�'�'�'�'���
/�
/�
/��"�)�)�#�.�.�.�.�.�.�.�.�.�����
/����	/�	/s�7�
A&�A!�!A&c�F�|j���}d|_|Sr:)rur�)r2rys  r%rxz$XMLPullParser._close_and_return_roots!���|�!�!�#�#������r$c�0�	|���dSr:)rxr7s r%r�zXMLPullParser.closes!��	�
	
�#�#�%�%�%�%�%r$c#�K�	|j}|r3|���}t|t��r|�|V�|�1dSdSr:)r��popleftr,�	Exception)r2rt�events   r%rwzXMLPullParser.read_events%sj����	�
�#���	��N�N�$�$�E��%��+�+�
��������	�	�	�	�	r$c�d�|j�td���|j���dS)Nz"flush() called after end of stream)rur��flushr7s r%r�zXMLPullParser.flush3s3���<���A�B�B�B���������r$r:)	r r!r"r4r�rxr�rwr�r#r$r%rr�s������
<�t�
<�
<�
<�
<�
<�/�/�/����&�&�&��������r$rc��	|stt�����}|�|��|���S�Nr��rrr�r�)rCr�s  r%rr9sE��	��1��+�-�-�0�0�0��
�K�K������<�<�>�>�r$c��	|stt�����}|�|��|���}i}|���D]}|�d��}|r|||<�||fS)Nr�r6)rrr�r�r�r{)rCr�rq�idsrEr6s      r%rrJs�����1��+�-�-�0�0�0��
�K�K������<�<�>�>�D�
�C��	�	������
�X�X�d�^�^��
�	��C��G����9�r$c��	|stt�����}|D]}|�|���|���Sr�r�)�sequencer�rCs   r%rrbsW����1��+�-�-�0�0�0���������D������<�<�>�>�r$c�V�eZdZ	d
ddddd�d�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d
d�Z
d�ZdS)rNF)�comment_factory�
pi_factory�insert_comments�
insert_pisc���g|_g|_d|_d|_d|_|�t
}||_||_|�t}||_	||_
|�t}||_dSr:)
�_data�_elem�_lastr��_tailr�_comment_factoryr�r�_pi_factoryr�r�_factory)r2�element_factoryr�r�r�r�s      r%r4zTreeBuilder.__init__�sr����
���
���
���
���
��"�%�O� /���.�����.�J�%���$����"�%�O�'��
�
�
r$c��	|jSr:r�r7s r%r�zTreeBuilder.close�s��I��z�r$c��|jrJ|j�:d�|j��}|jr
||j_n||j_g|_dSdS�Nr�)r�r��joinr�rDrC�r2rCs  r%�_flushzTreeBuilder._flush�s\���:�		��z�%��w�w�t�z�*�*���:�+�&*�D�J�O�O�'+�D�J�O��D�J�J�J�		�		r$c�<�	|j�|��dSr:)r�r]�r2r�s  r%r�zTreeBuilder.data�s!��*��
���$�����r$c��	|���|�||��x|_}|jr!|jd�|��n|j�||_|j�|��d|_|S)Nrbr)r�r�r�r�r]r�r�)r2r'�attrsrEs    r%�startzTreeBuilder.start�s���	�	
���
�
�
� �M�M�#�u�5�5�5��
�T��:�	��J�r�N�!�!�$�'�'�'�'�
�Z�
��D�J��
���$������
��r$c��	|���|j���|_d|_|jSr)r�r��popr�r�r�s  r%r�zTreeBuilder.end�s:��	�
	
���
�
�
��Z�^�^�%�%��
���
��z�r$c�F�	|�|j|j|��Sr:)�_handle_singler�r�r�s  r%�commentzTreeBuilder.comment�s.��	��"�"��!�4�#7��?�?�	?r$c�H�	|�|j|j||��Sr:)r�r�r�)r2r�rCs   r%�pizTreeBuilder.pi�s/��	�
�"�"���d�o�v�t�=�=�	=r$c��||�}|rI|���||_|jr |jd�|��d|_|S)Nrbr)r�r�r�r]r�)r2�factoryrd�argsrEs     r%r�zTreeBuilder._handle_single�sY���w��~���	��K�K�M�M�M��D�J��z�
,��
�2��%�%�d�+�+�+��D�J��r$r:)r r!r"r4r�r�r�r�r�r�r�r�r#r$r%rrts��������&(�!%�$�!&�5�(�(�(�(�(�(���
�
�
� � � ����"���?�?�?�=�=�=�=�����r$rc�`�eZdZ	ddd�d�Zd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�ZdS)rN)r�r�c�@�	ddlm}n3#t$r&	ddl}n#t$rtd���wxYwYnwxYw|�|d��}|�t��}|x|_|_|x|_|_	|j
|_i|_|j
|_t|d��r|j|_t|d��r|j|_t|d��r|j|_t|d��r|j|_t|d	��r|j|_t|d
��r|j|_t|d��r|j|_d|_d|_d|_ i|_!	d
|j"z|_#dS#tH$rYdSwxYw)Nr��expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r�r��start_ns�end_nsr�r�r�rzExpat %d.%d.%d)%�xml.parsersr��ImportError�pyexpat�ParserCreaterr�rur��_target�error�_error�_names�_default�DefaultHandlerExpandr(�_start�StartElementHandler�_end�EndElementHandler�	_start_ns�StartNamespaceDeclHandler�_end_ns�EndNamespaceDeclHandlerr��CharacterDataHandlerr��CommentHandlerr��ProcessingInstructionHandler�buffer_text�ordered_attributes�_doctype�entity�version_info�versionr�)r2r�r�r�r�s     r%r4zXMLParser.__init__�s���	�)�)�)�)�)�)�)���	�	�	�
�'�'�'�'�'���
�
�
�!�M����
����(�'�	�����#�#�H�c�2�2���>� �]�]�F�%+�+���d�l�%+�+���d�l��k������&*�m��#��6�7�#�#�	5�)-��F�&��6�5�!�!�	1�'+�y�F�$��6�:�&�&�	>�/3�~�F�,��6�8�$�$�	:�-1�\�F�*��6�6�"�"�	6�*0�+�F�'��6�9�%�%�	3�$*�N�F�!��6�4� � �	<�28�)�F�/����$%��!���
����	�+�e�.@�@�D�L�L�L���	�	�	��D�D�	���s.�	�
9��9�3�9�9�>F�
F�Fc���|j}|j}|D]�}|dkrd|_|||jfd�}||_�#|dkr|||jfd�}||_�=|dkr0t|jd��r
|||j	fd�}n||fd	�}||_
�s|d
kr0t|jd��r
|||jfd�}n||fd
�}||_��|dkr|||fd�}||_
��|dkr|||fd�}||_��td|z���dS)Nr�rc�4�|||||��f��dSr:r#)r'�	attrib_inr�r]r�s     r%�handlerz%XMLParser._setevents.<locals>.handler1s)���F�E�5�5��i�#8�#8�9�:�:�:�:�:r$r�c�2�||||��f��dSr:r#)r'r�r]r�s    r%r�z%XMLParser._setevents.<locals>.handler6s%���F�E�3�3�s�8�8�,�-�-�-�-�-r$zstart-nsr�c�4�|||||��f��dSr:r#)rrr�r]r�s     r%r�z%XMLParser._setevents.<locals>.handler=s)�����x�x���'<�'<�=�>�>�>�>�>r$c�,�|||pd|pdff��dSr�r#)rrr�r]s    r%r�z%XMLParser._setevents.<locals>.handlerAs*�������"�c�i�R�'@�A�B�B�B�B�Br$zend-nsr�c�2�||||��f��dSr:r#)rr�r]r�s    r%r�z%XMLParser._setevents.<locals>.handlerGs%�����v�v�f�~�~�6�7�7�7�7�7r$c� �||df��dSr:r#)rr�r]s   r%r�z%XMLParser._setevents.<locals>.handlerKs�����t�}�-�-�-�-�-r$r�c�P�|||j�|��f��dSr:)r�r�)rCr�r]r2s    r%r�z%XMLParser._setevents.<locals>.handlerOs-���F�E�4�;�#6�#6�t�#<�#<�=�>�>�>�>�>r$r�c�R�|||j�||��f��dSr:)r�r�)�	pi_targetr�r�r]r2s     r%r�z%XMLParser._setevents.<locals>.handlerSs-���F�E�4�;�>�>�)�T�#B�#B�C�D�D�D�D�Dr$zunknown event %r)rur]r�r�r�r�r�r(r�r�r�r�r�r�r�r�)r2�events_queue�events_to_reportr�r]�
event_namer�s       r%r�zXMLParser._setevents%s�������$��*�*	B�*	B�J��W�$�$�,-��)�2<�V�"&�+�;�;�;�;�.5��*�*��u�$�$�'1�&� $�	�.�.�.�.�,3��(�(��z�)�)��4�;�
�3�3�C�3=�f�)-��?�?�?�?�?�4>�f�C�C�C�C�3:��0�0��x�'�'��4�;��1�1�.�.8��'+�|�8�8�8�8�8�/9��.�.�.�.�18��.�.��y�(�(�(2�6��?�?�?�?�(/��%�%��t�#�#�3=�f�!%�E�E�E�E�7>��3�3� �!3�j�!@�A�A�A�U*	B�*	Br$c�b�t|��}|j|_|j|jf|_|�r:)r�code�lineno�offset�position)r2r~�errs   r%�_raiseerrorzXMLParser._raiseerrorZs-��������:����|�U�\�1����	r$c�n�	|j|}n%#t$r|}d|vrd|z}||j|<YnwxYw|S)Nr�r�)r��KeyError)r2r|�names   r%�_fixnamezXMLParser._fixname`s`��	$��;�s�#�D�D���	$�	$�	$��D��d�{�{��T�z��#�D�K�����		$����
�s�
�2�2c�@�|j�|pd|pd��Sr�)r�r��r2rrs   r%r�zXMLParser._start_nsks"���{�#�#�F�L�b�#�)��<�<�<r$c�:�|j�|pd��Sr�)r�r�)r2rs  r%r�zXMLParser._end_nsns���{�!�!�&�,�B�/�/�/r$c���|j}||��}i}|r>tdt|��d��D]}||dz||||��<� |j�||��S)NrrJr)r��rangerGr�r�)r2r'�	attr_list�fixnamer0�is      r%r�zXMLParser._startqs����-���g�c�l�l�����	?��1�c�)�n�n�a�0�0�
?�
?��09�!�A�#���w�w�y��|�,�,�-�-��{� � ��f�-�-�-r$c�\�|j�|�|����Sr:)r�r�r�r�s  r%r�zXMLParser._end}s"���{���t�}�}�S�1�1�2�2�2r$c��|dd�}|dkr�	|jj}n#t$rYdSwxYw	||j|dd���dS#t$raddlm}|�d||jj	|jj
fz��}d|_|jj	|_|jj
|_
|�wxYw|dkr|dd	�d
kr	g|_dS|j��|dkr	d|_dS|���}|sdS|j�|��t#|j��}|dkr�|jd}|d
kr|dkr|j\}}}	}
|	r
|	dd�}	n|dkr|dkr|j\}}}
d}	ndSt%|jd��r%|j�||	|
dd���n*t%|d��rt)jdt,��d|_dSdSdS)NrrDrbrr�z'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�rJ�PUBLIC��SYSTEM��doctypezaThe doctype() method of XMLParser is ignored.  Define doctype() method on the TreeBuilder target.)r�r�r�r�r�r�r�r�r��ErrorLineNumber�ErrorColumnNumberr�r�r�r�rir]rGr(rr=r>�RuntimeWarning)r2rCr�data_handlerr�r��nrgr��pubid�systems           r%r�zXMLParser._default�s}���b�q�b����S�=�=�
�#�{�/����!�
�
�
����
����
���T�[��a��d��4�5�5�5�5�5���

�

�

�-�-�-�-�-�-��k�k�=��4�;�6��K�1�3�3����
���!�[�8��
�!�[�:��
��	�

�����s�]�]�t�B�Q�B�x�;�6�6��D�M�M�M�
�]�
&���}�}� $��
����:�:�<�<�D��
����M� � ��&�&�&��D�M�"�"�A��1�u�u��}�Q�'���8�#�#��Q���04�
�-�D�$��v��,� %�a��d�����X�%�%�!�q�&�&�)-��&�D�$�� �E�E��F��4�;�	�2�2�(��K�'�'��e�V�A�b�D�\�B�B�B�B��T�9�-�-�(��M�M�&�(�(�(�
!%��
�
�
�;'�
&��us��
-�-�A�A+B<c��		|j�|d��dS#|j$r }|�|��Yd}~dSd}~wwxYw)NF)r��Parser�r�)r2r�rs   r%r�zXMLParser.feed�so��*�	 ��K���d�E�*�*�*�*�*���{�	 �	 �	 ����Q��������������	 ���s� �
A
�A�A
c�$�		|j�dd��n,#|j$r}|�|��Yd}~nd}~wwxYw	|jj}|��|`|`|`|`S#t$rYnwxYw	|`|`|`|`dS#|`|`|`|`wxYw)Nr$T)	r�rr�r�r�r�rur�r�)r2r�
close_handlers   r%r�zXMLParser.close�s���I�	 ��K���c�4�(�(�(�(���{�	 �	 �	 ����Q�������������	 ����		*� �K�-�M�!�=�?�?���T�\���T�\�\���	�	�	��D�	�����
��T�\���T�\�\�\����T�\���T�\�)�)�)�)s>��
A�A�A�A*�	B�*
A7�4B�6A7�7B�
Bc�p�|j���}	|j�d��|j�dd��n,#|j$r}|�|��Yd}~nd}~wwxYw|j�|��dS#|j�|��wxYw)NFr$)r��GetReparseDeferralEnabled�SetReparseDeferralEnabledrr�r�)r2�was_enabledrs   r%r�zXMLParser.flush�s����k�;�;�=�=��	?��K�1�1�%�8�8�8��K���c�5�)�)�)�)���{�	 �	 �	 ����Q�������������	 ����
�K�1�1�+�>�>�>�>�>��D�K�1�1�+�>�>�>�>���s/�5A�B�
A:�A5�0B�5A:�:B�B5)r r!r"r4r�r�r�r�r�r�r�r�r�r�r�r#r$r%rr�s��������"&��+�+�+�+�+�Z3B�3B�3B�j���	�	�	�=�=�=�0�0�0�
.�
.�
.�3�3�3�4%�4%�4%�l � � �*�*�*�"?�?�?�?�?r$r)�out�	from_filec�J�	|�|�td���d}|�tj��x}}tt	|jfi|�����}|�*|�|��|���n|�t||���|�|�	��ndS)Nz:Either 'xml_data' or 'from_file' must be provided as inputr�)r�)
r�r�rRrrr�r�r�rrT)�xml_datar r!�options�sior�s      r%rr�s������I�-��U�V�V�V�
�C�
�{��K�M�M�!��c�
�.�s�y�D�D�G�D�D�
E�
E�
E�F������H�����������	�	�
�i��'�'�'�'� �_�3�<�<�>�>�>�$�6r$z	^\w+:\w+$c��eZdZ	dddddddd�d�Zefd�Zd�Zdd�Zd�Zd	j	fd
�Z
d�Zd�Zdd
�Z
d�Zd�Zd�ZdS)rFN)�
with_comments�
strip_text�rewrite_prefixes�qname_aware_tags�qname_aware_attrs�
exclude_attrs�exclude_tagsc�X�||_g|_||_||_|rt	|��nd|_|rt	|��nd|_||_|rt	|��|_nd|_|rt	|��j	|_
nd|_
dgg|_g|_|s>|j�
tt�������|j�
g��i|_dg|_d|_d|_d|_d|_dS)N)r@r�Fr)�_writer��_with_comments�_strip_textr�_exclude_attrs�
_exclude_tags�_rewrite_prefixes�_qname_aware_tags�intersection�_find_qname_aware_attrs�_declared_ns_stack�	_ns_stackr]rrr��_prefix_map�_preserve_space�_pending_start�
_root_seen�
_root_done�_ignored_depth)	r2r�r'r(r)r*r+r,r-s	         r%r4zC14NWriterTarget.__init__sE�������
�+���%���4A�K�c�-�0�0�0�t���2>�H�S��.�.�.�D���!1����	*�%(�)9�%:�%:�D�"�"�%)�D�"��	0�+.�/@�+A�+A�+N�D�(�(�+/�D�(�
<�$
�#�������	@��N�!�!�$�~�';�';�'=�'=�">�">�?�?�?�����b�!�!�!���� %�w���"�������������r$c#�:K�||��D]}|r|Ed{V���
dSr:r#)r2�ns_stack�	_reversedros    r%�_iter_namespacesz!C14NWriterTarget._iter_namespaces7sJ����#�)�H�-�-�	&�	&�J��
&�%�%�%�%�%�%�%�%��	&�	&r$c��|�dd��\}}|�|j��D]\}}||kr
d|�d|��cS�td|�d|�d����)Nrrr�r�zPrefix z of QName "�" is not declared in scope)�splitrCr9r�)r2�
prefixed_namerr�r�ps      r%�_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name<s���$�*�*�3��2�2�����+�+�D�N�;�;�	*�	*�F�C���F�{�{�)�C�)�)�4�)�)�)�)�)���_�6�_�_�m�_�_�_�`�`�`r$c��|�4|dd�dkr|dd��dd��nd|f\}}n|}t��}|�|j��D]4\}}||kr||vr|r|�d|��n|||fcS|�|���5|jrd||jvr|j|}n!dt|j����x}|j|<|jd�||f��|�d|��||fS|s	d|vr|||fS|�|j	��D]=\}}||kr2|jd�||f��|r|�d|��n|||fcS�>|s|||fStd|�d	����)
Nrr�r�r�rrrbzNamespace "rE)rrrCr8�addr4r:rGr]r9r�)r2rrr'�
prefixes_seen�urs       r%�_qnamezC14NWriterTarget._qnameCs$���;�38��!��9��3C�3C�u�Q�R�R�y�'�'��Q�/�/�/�"�e��H�C����C����
��.�.�t�/F�G�G�	&�	&�I�A�v��C�x�x�F�-�7�7�,2�;�&�(�(�3�(�(�(��S�#�E�E�E�E����f�%�%�%�%��!�	/��d�&�&�&��)�#�.���1L�S��9I�5J�5J�1L�1L�L���)�#�.��#�B�'�.�.��V�}�=�=�=��$�$�s�$�$�c�3�.�.��	!�r��.�.���S�=� ��.�.�t�~�>�>�	F�	F�I�A�v��C�x�x��'��+�2�2�C��=�A�A�A�,2�;�&�(�(�3�(�(�(��S�#�E�E�E�E���	!���S�=� ��F�s�F�F�F�G�G�Gr$c�L�|js|j�|��dSdSr:)r?r�r]r�s  r%r�zC14NWriterTarget.datahs3���"�	$��J���d�#�#�#�#�#�	$�	$r$r�c�d�||j��}|jdd�=|jr!|jds|���}|j�7|jdc}|_|rt|��r|nd}|jg|�|�R�|�dS|r+|jr&|�t|����dSdSdS�Nrb)
r�r1r;rir<�_looks_like_prefix_namer�r=r/�_escape_cdata_c14n)r2�
_join_textr�r��
qname_texts     r%r�zC14NWriterTarget._flushls����z�$�*�%�%���J�q�q�q�M���	 �D�$8��$<�	 ��:�:�<�<�D���*�(,�(;�T�%�D�$�%�!%�Q�*A�$�*G�*G�Q���T�J��D�K�*��*�z�*�*�*�*��%����	2�D�O�	2��K�K�*�4�0�0�1�1�1�1�1�	2�	2�	2�	2r$c��|jrdS|jr|���|jd�||f��dSrQ)r?r�r�r9r]rs   r%r�zC14NWriterTarget.start_nszsN����	��F��:�	��K�K�M�M�M���r��!�!�3��-�0�0�0�0�0r$c�,�|j�"|js	||jvr|xjdz
c_dS|jr|���g}|j�|��|j�||jvr|||f|_dS|�|||��dSr)	r3r?r�r�r8r]r5r<r�)r2r'r��new_namespacess    r%r�zC14NWriterTarget.start�s�����)��#�*�'*�d�.@�'@�'@����1�$����F��:�	��K�K�M�M�M�����&�&�~�6�6�6��!�-�#��9O�2O�2O�#&��~�">�D���F����C���/�/�/�/�/r$c������j�"|r �fd�|���D��}|h|�}i}|�/��|��x}||<|�|���j�h|rf��|��}|rL|D]H}	||	}
t|
��r/��|
��x}||
<|�|���Ind}nd}�j��fd�t|d����D��}|r!d�|D��}|���ng}|rlt|�����D]J\}
}|�|
|vr||vr|||d}||
\}}	}|�	|r|n|	|f���K|�
d��}�j�	|r|dkn�jd	���j}|d
||dz��|r(|d�
d�|D������|d
��|�*|t|||d����d�_�j�	g��dS)Nc�.��i|]\}}|�jv�||��Sr#)r2)�.0rrr2s   �r%�
<dictcomp>z+C14NWriterTarget._start.<locals>.<dictcomp>�s,���T�T�T�d�a��q��@S�7S�7S�Q��7S�7S�7Sr$c�(��i|]}|�|����Sr#r#)r[r�parse_qnames  �r%r\z+C14NWriterTarget._start.<locals>.<dictcomp>�s/���4�4�4�q��K�K��N�N�4�4�4r$c�.�|�dd��S)Nr�r)rF)rs r%r�z)C14NWriterTarget._start.<locals>.<lambda>�s��!�'�'�#�q�/�/�r$rc�*�g|]\}}|rd|znd|f��S)zxmlns:�xmlnsr#)r[rrs   r%�
<listcomp>z+C14NWriterTarget._start.<locals>.<listcomp>�s@������C��'-�9��F�"�"�'�3�?���r$rz+{http://www.w3.org/XML/1998/namespace}space�preserverbr�r�c�@�g|]\}}d|�dt|���d���S)r�rr)�_escape_attrib_c14n)r[rrs   r%rbz+C14NWriterTarget._start.<locals>.<listcomp>�s9��T�T�T�$�!�Q�=�q�=�=�$7��$:�$:�=�=�=�T�T�Tr$r�T)r2r�rIrKr7rRrNr�sortr]r{r;r/r�rSr=r9)r2r'r�rXrUr��resolved_namesr�qattrs�	attr_namer~�
parsed_qnamesrrr�
attr_qnamer�space_behaviourr�r^s`                  @r%r�zC14NWriterTarget._start�s6������*�u�*�T�T�T�T�e�k�k�m�m�T�T�T�E���������!�15�1J�1J�:�1V�1V�V�E�N�:�.��J�J�u�����'�3��3��1�1�%�8�8�F��
�!'�*�*�I�!�)�,�E�.�u�5�5�*�8<�8Q�8Q�RW�8X�8X�X���u� 5��
�
�5�)�)�)��	*�����F��k��4�4�4�4�F��1�1�53�53�53�4�4�4�
��	���#1����I�
�N�N������I��	H��u�{�{�}�}�-�-�
H�
H���1��%�!�v�+�+�!�~�:M�:M�%�n�Q�&7�8��;�A�-:�1�-=�*�
�I�s�� � ��"B�*�*��A�!F�G�G�G�G� �)�)�$Q�R�R����#�#�-<�
*�O�z�)�)��%�b�)�	+�	+�	+�
���
��c�M�#�&�q�)�)�*�*�*��	W��E�"�'�'�T�T�)�T�T�T�U�U�V�V�V�
��c�
�
�
��!��E�$�]�>�*�3M�%N�q�%Q�R�R�S�S�S��������b�!�!�!�!�!r$c��|jr|xjdzc_dS|jr|���|�d|�|��d�d���|j���t|j��dk|_|j	���|j
���dS)Nrrrr�)r?r�r�r/rNr;r�rGr>r8r9r�s  r%r�zC14NWriterTarget.end�s�����	����1�$����F��:�	��K�K�M�M�M����/����S�)�)�!�,�/�/�/�0�0�0��� � �"�"�"��d�2�3�3�q�8�����#�#�%�%�%���������r$c�0�|jsdS|jrdS|jr|�d��n"|jr|jr|���|�dt|���d���|js|�d��dSdS)Nr�z<!--z-->)r0r?r>r/r=r�r�rSr�s  r%r�zC14NWriterTarget.comment�s����"�	��F���	��F��?�	��K�K������
�_�	���	��K�K�M�M�M����8�-�d�3�3�8�8�8�9�9�9���	��K�K�������	�	r$c�4�|jrdS|jr|�d��n"|jr|jr|���|�|rd|�dt
|���d�nd|�d���|js|�d��dSdS)Nr�z<?r�z?>)r?r>r/r=r�r�rS)r2r�r�s   r%r�zC14NWriterTarget.pi�s�����	��F��?�	��K�K������
�_�	���	��K�K�M�M�M����:>�S�6��6�6�,�T�2�2�6�6�6�6�O��O�O�O�	U�	U�	U���	��K�K�������	�	r$r:)r r!r"r4�reversedrCrIrNr�r�r�r�r�r�r�r�r�r#r$r%rr�s�������, %���"&�$�#�$�# �# �# �# �# �J4<�&�&�&�&�
a�a�a�#H�#H�#H�#H�J$�$�$�!#��2�2�2�2�1�1�1�0�0�0�"C"�C"�C"�C"�J
�
�
����
�
�
�
�
r$rc�&�	d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}|S#ttf$rt|��YdSwxYw)	NrDrEr�rFr�rGrM�&#xD;rHr�s r%rSrS�s���)��$�;�;��<�<��W�-�-�D��$�;�;��<�<��V�,�,�D��$�;�;��<�<��V�,�,�D��4�<�<��<�<��g�.�.�D�����~�&�)�)�)�"�4�(�(�(�(�(�(�)���s�A)A,�, B�Bc��	d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}d|vr|�dd��}d	|vr|�d	d
��}d|vr|�dd��}|S#ttf$rt|��YdSwxYw)
NrDrEr�rFrrLrNz&#x9;r�z&#xA;rMrrrHr�s r%reres���)��$�;�;��<�<��W�-�-�D��$�;�;��<�<��V�,�,�D��$�;�;��<�<��X�.�.�D��4�<�<��<�<��g�.�.�D��4�<�<��<�<��g�.�.�D��4�<�<��<�<��g�.�.�D�����~�&�)�)�)�"�4�(�(�(�(�(�(�)���s�BB �  C�C)r�)�_set_factoriesr:r�)rer)?�__all__rrcr9r=r�r��collections.abcr�r�r�rr�rr	rrrrr
rr�contextmanagerr�r�rr3r1r�r�rrrrrr2rr�rWrrrrr
rrrrrrrr�compile�UNICODEr:rRrrSrerf�_elementtreertr�r#r$r%�<module>r{s"��!�P����(��
�
�
�
�	�	�	�	�����	�	�	�	�����������������������		�		�		�		�		��		�		�		�#�#�#�
j�j�j�j�j�j�j�j�Z	$&�����$�������� ��+"�+"�+"�+"�+"�+"�+"�+"�`_/�_/�_/�_/�_/�_/�_/�_/�H��/+�/+���/+�b;�;�;�;�z0(�0(�0(�d���
�0(�0(�0(�d��������
�!�!�!�*-2�$*�38�(.�(,�16�(,����%3��!�
�
�
�
)�)�)� )�)�)�8)�)�)��!�T�"&������0�����b�'����"
�!%��&*�
�
�
�
�
����&/�/�/�/�l����5�5�5�5�p7�7�7�7�7�7�7�7�t����"����,�
�
�
�
�
�$v�v�v�v�v�v�v�v�th?�h?�h?�h?�h?�h?�h?�h?�Z7�t�t�7�7�7�7�7�<%�"�*�\�2�:�>�>�D����������D)�)�)�&)�)�)�.3��K�����+�+�+�+�+�+��N�7�1�2�2�2�2�2���	�	�	��D�D�	���s�E6�6E?�>E?

?>