AlkantarClanX12

Your IP : 18.219.18.238


Current Path : /opt/alt/python310/lib64/python3.10/xml/etree/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/xml/etree/__pycache__/ElementTree.cpython-310.opt-2.pyc

o

6��fL"�@s�	gd�ZdZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
Gdd�de�Zdd	�Z
Gd
d�d�Zifdd
�Zd]dd�Zd]dd�ZeZGdd�d�ZGdd�d�Zejdd��Zd]dd�Zdd�ZdZzee�ZWn	ey}Ynwdd�Zdd �Zeeed!�Zd"d#�Zd$d%d&d'd(d)d*d+�Z e e_ d,d-�Z!d.d/�Z"d0d1�Z#d2d3�Z$d^ddd4d5�d6d7�Z%Gd8d9�d9ej&�Z'd^ddd4d5�d:d;�Z(d<d=�Z)d_d?d@�Z*d]dAdB�Z+d^dCdD�Z,GdEdF�dF�Z-d]dGdH�Z.d]dIdJ�Z/e.Z0d]dKdL�Z1GdMdN�dN�Z2GdOdP�dP�Z3d]dddQ�dRdS�Z4e�5dTej6�j7Z8GdUdV�dV�Z9dWdX�Z:dYdZ�Z;zeZ<dd[l=Tdd\l=m>Z>Wne?�y<YdSwe>ee�dS)`)�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@seZdZ	dS)rN)�__name__�
__module__�__qualname__�r!r!�</opt/alt/python310/lib64/python3.10/xml/etree/ElementTree.pyrjsrcCs	t|d�S)N�tag)�hasattr)�elementr!r!r"rxs
rc@seZdZ	dZ	dZ	dZ	dZ	ifdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd6d d!�Zd7d"d#�Zd6d$d%�Zd6d&d'�Zd(d)�Zd6d*d+�Zd,d-�Zd.d/�Zd0d1�Zd6d2d3�Zd4d5�Z dS)8rNcKs:t|t�std|jjf��||_i|�|�|_g|_dS)Nzattrib must be dict, not %s)�
isinstance�dict�	TypeError�	__class__rr#�attrib�	_children)�selfr#r*�extrar!r!r"�__init__�s
�
zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r)rr#�id�r,r!r!r"�__repr__��zElement.__repr__cCs	|�||�S�N)r))r,r#r*r!r!r"�makeelement�szElement.makeelementcCs	t�dt�|��S)Nz7elem.copy() is deprecated. Use copy.copy(elem) instead.)�warnings�warn�DeprecationWarning�__copy__r0r!r!r"�copy�s�zElement.copycCs0|�|j|j�}|j|_|j|_||dd�<|Sr3)r4r#r*�text�tail)r,�elemr!r!r"r8�s
zElement.__copy__cC�
t|j�Sr3)�lenr+r0r!r!r"�__len__��
zElement.__len__cCstjdtdd�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)r5r6�
FutureWarningr>r+r0r!r!r"�__bool__�s
�zElement.__bool__cCs
|j|Sr3�r+�r,�indexr!r!r"�__getitem__�r@zElement.__getitem__cCs8t|t�r|D]}|�|�qn|�|�||j|<dSr3)r&�slice�_assert_is_elementr+)r,rHr%�eltr!r!r"�__setitem__�s
�
zElement.__setitem__cCs|j|=dSr3rFrGr!r!r"�__delitem__�szElement.__delitem__cCs	|�|�|j�|�dSr3�rKr+�append�r,�
subelementr!r!r"rP�s
zElement.appendcCs&	|D]
}|�|�|j�|�qdSr3rO)r,�elementsr%r!r!r"�extend�s

�zElement.extendcCs	|�|�|j�||�dSr3)rKr+�insert)r,rHrRr!r!r"rUs
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r&�_Element_Pyr(�typer)r,�er!r!r"rKs
�zElement._assert_is_elementcC�	|j�|�dSr3)r+�removerQr!r!r"rZszElement.removecC�	t�|||�Sr3)r�find�r,�path�
namespacesr!r!r"r\�zElement.findcCs	t�||||�Sr3)r�findtext�r,r^�defaultr_r!r!r"ra&szElement.findtextcCr[r3)r�findallr]r!r!r"rd4r`zElement.findallcCr[r3)r�iterfindr]r!r!r"re?r`zElement.iterfindcCs"	|j��g|_d|_|_dSr3)r*�clearr+r:r;r0r!r!r"rfJs
z
Element.clearcCs	|j�||�Sr3)r*�get)r,�keyrcr!r!r"rgUs
zElement.getcCs	||j|<dSr3)r*)r,rh�valuer!r!r"�setbszElement.setcC�	|j��Sr3)r*�keysr0r!r!r"rlls
zElement.keyscCrkr3)r*�itemsr0r!r!r"rmus
z
Element.itemsccsH�	|dkrd}|dus|j|kr|V|jD]
}|�|�EdHqdS)N�*)r#r+�iter)r,r#rXr!r!r"ro�s�
�zElement.iterccs\�	|j}t|t�s|durdS|j}|r|V|D]}|��EdH|j}|r+|VqdSr3)r#r&�strr:�itertextr;)r,r#�trXr!r!r"rq�s���zElement.itertextr3�NN)!rrr r#r*r:r;r.r1r4r9r8r?rErIrMrNrPrTrUrKrZr\rardrerfrgrjrlrmrorqr!r!r!r"r}sH








	
rcKs(	i|�|�}|�||�}|�|�|Sr3)r4rP)�parentr#r*r-r%r!r!r"r�s

rcCs	tt�}||_|Sr3)rrr:)r:r%r!r!r"r�srcCs(	tt�}||_|r|jd||_|S)N� )rr
r:)�targetr:r%r!r!r"r
�s	r
c@sXeZdZ	ddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rNcCs|rd||f}||_dS)Nz{%s}%s�r:)r,Ztext_or_urir#r!r!r"r.�s
zQName.__init__cCs|jSr3rwr0r!r!r"�__str__�sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r)rr:r0r!r!r"r1��zQName.__repr__cCr=r3)�hashr:r0r!r!r"�__hash__�r@zQName.__hash__cCs t|t�r|j|jkS|j|kSr3�r&rr:�r,�otherr!r!r"�__le__��

zQName.__le__cCs t|t�r|j|jkS|j|kSr3r|r}r!r!r"�__lt__�r�zQName.__lt__cCs t|t�r|j|jkS|j|kSr3r|r}r!r!r"�__ge__�r�zQName.__ge__cCs t|t�r|j|jkS|j|kSr3r|r}r!r!r"�__gt__r�zQName.__gt__cCs t|t�r|j|jkS|j|kSr3r|r}r!r!r"�__eq__r�zQName.__eq__r3)rrr r.rxr1r{rr�r�r�r�r!r!r!r"r�s

rc@s�eZdZ	ddd�Zdd�Zdd�Zddd	�Zdd
d�Zddd
�Zddd�Z	ddd�Z
ddd�Z				ddd�dd�Zdd�Z
dS)rNcCs||_|r|�|�dSdSr3)�_rootr
)r,r%�filer!r!r"r.s�zElementTree.__init__cC�	|jSr3�r�r0r!r!r"�getrootszElementTree.getrootcCs	||_dSr3r�)r,r%r!r!r"�_setroot"s
zElementTree._setrootcCs�	d}t|d�st|d�}d}z<|dur-t�}t|d�r-|�|�|_|jW|r,|��SS	|�d�}|s6n|�|�q.|��|_|jW|rK|��SS|rS|��ww)NF�read�rbT�_parse_wholei)r$�openrr�r��closer��feed)r,�source�parser�close_source�datar!r!r"r
,s6



	
��

�

�
�zElementTree.parsecCs	|j�|�Sr3)r�ro�r,r#r!r!r"roQs	zElementTree.itercC�<	|dd�dkrd|}tjd|tdd�|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 %rrArB)r5r6rDr�r\r]r!r!r"r\]���zElementTree.findcCs>	|dd�dkrd|}tjd|tdd�|j�|||�Sr�)r5r6rDr�rarbr!r!r"rass��zElementTree.findtextcCr�r�)r5r6rDr�rdr]r!r!r"rd�r�zElementTree.findallcCr�r�)r5r6rDr�rer]r!r!r"re�r�zElementTree.iterfindT��short_empty_elementscCs�	|sd}n
|tvrtd|��|s|dkrd}nd}t||��Q\}}|dkr@|s9|dur@|��dkr@|��dvr@|d|f�|d	krKt||j�nt|j|�\}	}
t|}|||j|	|
|d
�Wd�dSWd�dS1stwYdS)N�xmlzunknown method %r�c14n�utf-8�us-ascii�unicode)r�r�z$<?xml version='1.0' encoding='%s'?>
r:r�)�
_serialize�
ValueError�_get_writer�lower�_serialize_textr��_namespaces)r,�file_or_filename�encoding�xml_declaration�default_namespace�methodr��writeZdeclared_encoding�qnamesr_Z	serializer!r!r"r��s6���"�zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r,r�r!r!r"�
write_c14n�szElementTree.write_c14nrsr3)NNNN)rrr r.r�r�r
ror\rardrer�r�r!r!r!r"r
s&




%



��5rccsf�z|j}Wn2ty8|��dkrd}t|d|dd��}|j|fVWd�YdS1s0wYYdSw|��dkrL|t|dd�pGdfVdSt���Y}t|tj	�rZ|}n2t|tj
�rlt�|�}|�|j
�n t�	�}dd�|_||_z
|j|_|j|_Wn	ty�Ynwtj||dd	d
�}|�|j
�|j|fVWd�dS1s�wYdS)Nr�r��w�xmlcharrefreplace)r��errorsr�cS�dS�NTr!r!r!r!r"�<lambda>sz_get_writer.<locals>.<lambda>�
)r�r��newline)r��AttributeErrorr�r��getattr�
contextlib�	ExitStackr&�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�
TextIOWrapper)r�r�r�r��stackr!r!r"r��sL�
�&��



��"�r�csddi�i��rd��<���fdd�}|��D]m}|j}t|t�r-|j�vr,||j�nt|t�r;|�vr:||�n|durK|turK|turKt|�|�	�D]#\}}t|t�r[|j}|�vrc||�t|t�rr|j�vrr||j�qO|j}t|t�r�|j�vr�||j�q��fS)N�cs�zU|dd�dkrI|dd��dd�\}}��|�}|dur5t�|�}|dur-dt��}|dkr5|�|<|rBd||f�|<WdS|�|<WdS�rOtd��|�|<WdStyct|�YdSw)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitrg�_namespace_mapr>r�r(�_raise_serialization_error)�qname�urir#�prefix�r�r_r�r!r"�	add_qname.s*

��z_namespaces.<locals>.add_qname)
ror#r&rr:rprrr�rm)r<r�r�r#rhrir:r!r�r"r�#s<


�
�

�
�r�cKs�|j}|j}|tur|d|�n�|tur|d|�n�||}|dur;|r,|t|��|D]}t|||d|d�q.n�|d|�t|���}	|	sK|r�|rlt|��dd�d�D]\}
}|rad|}|d	|t	|
�f�qW|	D]%\}}
t
|t�rz|j}t
|
t�r�||
j}
nt	|
�}
|d
|||
f�qn|s�t|�s�|s�|d�|r�|t|��|D]}t|||d|d�q�|d|d�n|d
�|j
r�|t|j
��dSdS)N�	<!--%s-->�<?%s?>r��<cS�|dS�Nrr!��xr!r!r"r�v�z _serialize_xml.<locals>.<lambda>�rh�:�
 xmlns%s="%s"� %s="%s"�>�</z />)r#r:rr
�
_escape_cdata�_serialize_xml�listrm�sorted�_escape_attribr&rr>r;)r�r<r�r_r��kwargsr#r:rXrm�v�kr!r!r"r�`s`
���
�


��r�)
Zarea�baseZbasefont�br�col�frameZhrZimg�inputZisindex�link�metaZparamcKs�|j}|j}|tur|dt|��n�|tur |dt|��n�||}|dur=|r0|t|��|D]	}t|||d�q2n�|d|�t|���}|sM|r�|rnt|��dd�d�D]\}	}
|
rcd|
}
|d|
t	|	�f�qY|D]%\}
}	t
|
t�r||
j}
t
|	t�r�||	j}	nt|	�}	|d	||
|	f�qp|d
�|�
�}|r�|dks�|dkr�||�n|t|��|D]	}t|||d�q�|tvr�|d
|d
�|jr�|t|j��dSdS)Nr�r�r�cSr�r�r!r�r!r!r"r��r�z!_serialize_html.<locals>.<lambda>r�r�r�r�r�ZscriptZstyler�)r#r:rr�r
�_serialize_htmlr�rmr�r�r&r�_escape_attrib_htmlr��
HTML_EMPTYr;)r�r<r�r_r�r#r:rXrmr�r�Zltagr!r!r"r��s\��
�


�r�cCs.|��D]}||�q|jr||j�dSdSr3)rqr;)r�r<�partr!r!r"r��s

�r�)r��htmlr:cCsN	t�d|�rtd��tt���D]\}}||ks||kr t|=q|t|<dS)Nzns\d+$z'Prefix format reserved for internal use)�re�matchr�r�r�rm)r�r�r�r�r!r!r"r�s�rr�r�ZrdfZwsdlZxsZxsiZdc)�$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/cCstd|t|�jf��)Nzcannot serialize %r (type %s))r(rWrrwr!r!r"r��s�r�c	C�dz!d|vr|�dd�}d|vr|�dd�}d|vr|�dd�}|WSttfy1t|�YdSw)N�&�&amp;r��&lt;r��&gt;��replacer(r�r�rwr!r!r"r�s�r�c	Cs�zId|vr|�dd�}d|vr|�dd�}d|vr|�dd�}d|vr)|�dd�}d	|vr3|�d	d
�}d|vr=|�dd�}d
|vrG|�d
d�}|WSttfyYt|�YdSw)Nr�r�r�r�r�r��"�&quot;�
z&#13;r�z&#10;�	z&#09;r�rwr!r!r"r�s&�r�c	Cr�)Nr�r�r�r�r�r�r�rwr!r!r"r�.s�r�T)r�r�r�cCs<	|dkr	t��nt��}t|�j||||||d�|��S)Nr��r�r�r�r�)r��StringIO�BytesIOrr��getvalue)r%r�r�r�r�r��streamr!r!r"r=s
�rc@s6eZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_ListDataStreamcCs
||_dSr3)�lst)r,rr!r!r"r.Wr@z_ListDataStream.__init__cCr�r�r!r0r!r!r"r�Z�z_ListDataStream.writablecCr�r�r!r0r!r!r"r�]r	z_ListDataStream.seekablecCs|j�|�dSr3)rrP)r,�br!r!r"r�`�z_ListDataStream.writecCr=r3)r>rr0r!r!r"r�cr@z_ListDataStream.tellN)rrr r.r�r�r�r�r!r!r!r"rUsrcCs*g}t|�}t|�j||||||d�|S)Nr)rrr�)r%r�r�r�r�r�rrr!r!r"rfs�rcCsR	t|t�s
t|�}|jtjdd�|��j}|r|ddkr'tj�d�dSdS)Nr�)r����r�)r&rr��sys�stdoutr�r;)r<r;r!r!r"rss


�r�  csb	t|t�r
|��}|dkrtd|����t|�sdSd|�g����fdd���|d�dS)Nrz,Initial indentation level must be >= 0, got r�cs�|d}z�|}Wnty�|�}��|�Ynw|jr'|j��s*||_|D]}t|�r7�||�|jr?|j��sB||_q,|j��sO�||_dSdSr�)�
IndexErrorrPr:�stripr>r;)r<�levelZchild_levelZchild_indentation�child��_indent_childrenZindentations�spacer!r"r�s$�
�
�z indent.<locals>._indent_children)r&rr�r�r>)�treerrr!rr"r�s
rcCs	t�}|�||�|Sr3)rr
)r�r�rr!r!r"r
�sr
csR	t||d����fdd��G��fdd�dtjj�}|��d�_�~t���S)N)�events�_parserc3s��d}z>t|d�st|d�}d}dV	���EdH|�d�}|s#n��|�q���}���EdH|�_W|r@|��dSdS|rI|��ww)NFr�r�Ti@)r$r��read_eventsr�r��_close_and_return_root�rootr�)r�r�r�r)�it�
pullparserr!r"�iterator�s,�



��
�ziterparse.<locals>.iteratorcseZdZ���jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr �__next__r!)rr�r!r"�IterParseIterator�sr!)r�collections�abc�Iteratorr�next)r�rr�r!r!)rrrr�r"r	�sr	c@sDeZdZddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdS)rN)rcCs<t��|_|ptt�d�|_|durd}|j�|j|�dS)N�rv)�end)r"�deque�
_events_queuerrr�
_setevents)r,rrr!r!r"r.�s

zXMLPullParser.__init__c
Csb	|jdur
td��|r/z	|j�|�WdSty.}z
|j�|�WYd}~dSd}~wwdS)Nz!feed() called after end of stream)rr�r��SyntaxErrorr)rP)r,r��excr!r!r"r�
s
���zXMLPullParser.feedcCs|j��}d|_|Sr3)rr�)r,rr!r!r"rs
z$XMLPullParser._close_and_return_rootcCs	|��dSr3)rr0r!r!r"r�szXMLPullParser.closeccs6�	|j}|r|��}t|t�r|�|V|sdSdSr3)r)�popleftr&�	Exception)r,r�eventr!r!r"r"s�
�zXMLPullParser.read_eventscCs |jdur	td��|j��dS)Nz"flush() called after end of stream)rr��flushr0r!r!r"r00s
zXMLPullParser.flushr3)	rrr r.r�rr�rr0r!r!r!r"r�s
rcCs$	|s	tt�d�}|�|�|��S�Nr&�rrr�r�)r:r�r!r!r"r6s


rcCsT	|s	tt�d�}|�|�|��}i}|��D]
}|�d�}|r%|||<q||fS)Nr&r/)rrr�r�rorg)r:r�rZidsr<r/r!r!r"rGs	

�rcCs.	|s	tt�d�}|D]}|�|�q|��Sr1r2)Zsequencer�r:r!r!r"r_src@sfeZdZ	dddddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	ddd�Z
dd�ZdS)rNF)�comment_factory�
pi_factory�insert_comments�
insert_piscCsdg|_g|_d|_d|_d|_|durt}||_||_|dur!t}||_	||_
|dur-t}||_dSr3)
�_data�_elem�_lastr��_tailr�_comment_factoryr5r
�_pi_factoryr6r�_factory)r,Zelement_factoryr3r4r5r6r!r!r"r.�s 
zTreeBuilder.__init__cCr�r3r�r0r!r!r"r��szTreeBuilder.closecCsB|jr|jdurd�|j�}|jr||j_n||j_g|_dSdS�Nr�)r7r9�joinr:r;r:�r,r:r!r!r"�_flush�s


�zTreeBuilder._flushcCrYr3)r7rP�r,r�r!r!r"r��szTreeBuilder.datacCsZ	|��|�||�|_}|jr|jd�|�n|jdur"||_|j�|�d|_|S)Nrr)rAr=r9r8rPr�r:)r,r#�attrsr<r!r!r"�start�s
zTreeBuilder.startcCs"	|��|j��|_d|_|jSr�)rAr8�popr9r:r�r!r!r"r'�s
zTreeBuilder.endcCs	|�|j|j|�Sr3)�_handle_singler;r5r@r!r!r"�comment�s
�zTreeBuilder.commentcCs	|�|j|j||�Sr3)rFr<r6)r,rvr:r!r!r"�pi�s�zTreeBuilder.picGs:||�}|r|��||_|jr|jd�|�d|_|S)Nrr)rAr9r8rPr:)r,�factoryrU�argsr<r!r!r"rF�szTreeBuilder._handle_singler3)rrr r.r�rAr�rDr'rGrHrFr!r!r!r"rqs�
	rc@sveZdZ	ddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rN)rvr�cCsNzddlm}Wnty#zddl}Wnty td��wYnw|�|d�}|dur1t�}||_|_||_|_	|j
|_i|_|j
|_t|d�rQ|j|_t|d�rZ|j|_t|d�rc|j|_t|d�rl|j|_t|d	�ru|j|_t|d
�r~|j|_t|d�r�|j|_d|_d|_d|_ i|_!z	d
|j"|_#WdSt$y�YdSw)Nr��expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�rDr'�start_ns�end_nsr�rGrHrzExpat %d.%d.%d)%�xml.parsersrL�ImportErrorZpyexpatZParserCreaterr�rrv�_target�error�_error�_names�_defaultZDefaultHandlerExpandr$�_start�StartElementHandler�_end�EndElementHandler�	_start_ns�StartNamespaceDeclHandler�_end_ns�EndNamespaceDeclHandlerr�ZCharacterDataHandlerrG�CommentHandlerrH�ProcessingInstructionHandlerZbuffer_text�ordered_attributes�_doctype�entity�version_info�versionr�)r,rvr�rLr�r!r!r"r.�sV����






�zXMLParser.__init__cCs*|j}|j}|D]�}|dkrd|_|||jfdd�}||_q|dkr/|||jfdd�}||_q|dkrNt|jd�rC|||j	fd	d�}n||fd
d�}||_
q|dkrmt|jd�rb|||jfd
d�}n||fdd�}||_q|dkr}|||fdd�}||_
q|dkr�|||fdd�}||_qtd|��dS)NrDrcS�|||||�f�dSr3r!)r#Z	attrib_inr/rPrDr!r!r"�handler.�z%XMLParser._setevents.<locals>.handlerr'cS�||||�f�dSr3r!)r#r/rPr'r!r!r"rf3�zstart-nsrMcSrer3r!)r�r�r/rPrMr!r!r"rf:rgcSs|||pd|pdff�dSr>r!)r�r�r/rPr!r!r"rf>szend-nsrNcSrhr3r!)r�r/rPrNr!r!r"rfDricSs||df�dSr3r!)r�r/rPr!r!r"rfHrrGcSs|||j�|�f�dSr3)rvrG)r:r/rPr,r!r!r"rfLr2rHcSs|||j�||�f�dSr3)rvrH)Z	pi_targetr�r/rPr,r!r!r"rfPszunknown event %r)rrPr`rVrWrXrYr$rvrZr[r\r]r^r_r�)r,Zevents_queueZevents_to_reportr�rPZ
event_namerfr!r!r"r*"sL
�
���
��zXMLParser._seteventscCs"t|�}|j|_|j|jf|_|�r3)r�code�lineno�offsetZposition)r,ri�errr!r!r"�_raiseerrorWszXMLParser._raiseerrorcCsDz|j|}W|Sty!|}d|vrd|}||j|<Y|Sw)Nr�r�)rT�KeyError)r,rh�namer!r!r"�_fixname]s��zXMLParser._fixnamecCs|j�|pd|p	d�Sr>)rvrM�r,r�r�r!r!r"rZhszXMLParser._start_nscCs|j�|pd�Sr>)rvrN)r,r�r!r!r"r\krzXMLParser._end_nscCsR|j}||�}i}|r"tdt|�d�D]}||d||||�<q|j�||�S)NrrAr)rq�ranger>rvrD)r,r#�	attr_listZfixnamer*�ir!r!r"rVnszXMLParser._startcCs|j�|�|��Sr3)rvr'rqr�r!r!r"rXzryzXMLParser._endc	Cs�|dd�}|dkrTz|jj}Wn
tyYdSwz||j|dd��WdStySddlm}|�d||jj	|jj
f�}d|_|jj	|_|jj
|_
|�w|dkre|dd	�d
kreg|_dS|jdur�|dkrsd|_dS|��}|s{dS|j�|�t|j�}|dkr�|jd}|d
kr�|dkr�|j\}}}	}
|	r�|	dd�}	n|dkr�|dkr�|j\}}}
d}	ndSt|jd�r�|j�||	|
dd��nt|d�r�t�dt�d|_dSdSdS)Nrr�rrrKz'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�rAZPUBLIC�ZSYSTEM��doctypezaThe doctype() method of XMLParser is ignored.  Define doctype() method on the TreeBuilder target.)rvr�r�rbrorOrLrRr�ZErrorLineNumberZErrorColumnNumberrjrkrlrarrPr>r$rzr5r6�RuntimeWarning)r,r:r�Zdata_handlerrLrm�nrWrpZpubid�systemr!r!r"rU}sn����

�



�
�
�
zXMLParser._defaultc
CsJ	z
|j�|d�WdS|jy$}z|�|�WYd}~dSd}~ww)NF)r��ParserSrn)r,r�r�r!r!r"r��s��zXMLParser.feedc
Cs�	z	|j�dd�Wn|jy"}z|�|�WYd}~nd}~wwz'z|jj}Wn	ty3Yn
w|�W|`|`|`|`SW|`|`|`|`dS|`|`|`|`w)N�T)	r�r~rSrnrvr�r�rrQ)r,r�Z
close_handlerr!r!r"r��s(���
��
zXMLParser.closec
Cs�|j��}z:z|j�d�|j�dd�Wn|jy-}z|�|�WYd}~nd}~wwW|j�|�dSW|j�|�dS|j�|�w)NFr)r�ZGetReparseDeferralEnabledZSetReparseDeferralEnabledr~rSrn)r,Zwas_enabledr�r!r!r"r0�s
����zXMLParser.flush)rrr r.r*rnrqrZr\rVrXrUr�r�r0r!r!r!r"r�s	-56r)�out�	from_filecKs�	|dur
|dur
td��d}|durt��}}tt|jfi|��d�}|dur3|�|�|��n
|dur=t||d�|durE|�	�SdS)Nz:Either 'xml_data' or 'from_file' must be provided as inputr&)r�)
r�r�rrrr�r�r�r
r)Zxml_datar�r�ZoptionsZsior�r!r!r"r�s

rz	^\w+:\w+$c@s�eZdZ	dddddddd�dd�Zefdd�Zdd	�Zdd
d�Zdd
�Zdj	fdd�Z
dd�Zdd�Zddd�Z
dd�Zdd�Zdd�ZdS)rFN)�
with_comments�
strip_text�rewrite_prefixes�qname_aware_tags�qname_aware_attrs�
exclude_attrs�exclude_tagsc	Cs�||_g|_||_||_|rt|�nd|_|rt|�nd|_||_|r)t|�|_nd|_|r5t|�j	|_
nd|_
dgg|_g|_|sL|j�
tt����|j�
g�i|_dg|_d|_d|_d|_d|_dS)N)r�r�Fr)�_writer7�_with_comments�_strip_textrj�_exclude_attrs�
_exclude_tags�_rewrite_prefixes�_qname_aware_tags�intersection�_find_qname_aware_attrs�_declared_ns_stack�	_ns_stackrPr�r�rm�_prefix_map�_preserve_space�_pending_start�
_root_seen�
_root_done�_ignored_depth)	r,r�r�r�r�r�r�r�r�r!r!r"r.s2�
zC14NWriterTarget.__init__ccs"�||�D]	}|r|EdHqdSr3r!)r,Zns_stackZ	_reversedr_r!r!r"�_iter_namespaces4s�
��z!C14NWriterTarget._iter_namespacescCsX|�dd�\}}|�|j�D]\}}||kr d|�d|��Sqtd|�d|�d���)Nr�rr�r�zPrefix z of QName "�" is not declared in scope)�splitr�r�r�)r,Z
prefixed_namer�rpr��pr!r!r"�_resolve_prefix_name9s�z%C14NWriterTarget._resolve_prefix_namecCsx|dur|dd�dkr|dd��dd�nd|f\}}n|}t�}|�|j�D]!\}}||krD||vrD|r=|�d|��n|||fS|�|�q(|jry||jvrX|j|}n
dt|j���}|j|<|jd�||f�|�d|��||fS|s�d|vr�|||fS|�|j	�D]"\}}||kr�|jd�||f�|r�|�d|��n|||fSq�|s�|||fSt
d|�d	���)
Nrr�r�r�r�r|rzNamespace "r�)r�rjr�r��addr�r�r>rPr�r�)r,r�r�r#Z
prefixes_seen�ur�r!r!r"�_qname@s02 

 �
zC14NWriterTarget._qnamecCs|js|j�|�dSdSr3)r�r7rPrBr!r!r"r�es�zC14NWriterTarget.datar�cCs�||j�}|jdd�=|jr|jds|��}|jdur=|jd}|_|r+t|�r+|nd}|jg|�|�R�|dur=dS|rK|jrM|�t	|��dSdSdS�Nr)
r7r�r�rr��_looks_like_prefix_namerVr�r��_escape_cdata_c14n)r,Z
_join_textr�rJ�
qname_textr!r!r"rAis


�zC14NWriterTarget._flushcCs0|jrdS|jr|��|jd�||f�dSr�)r�r7rAr�rPrrr!r!r"rMws
zC14NWriterTarget.start_nscCs�|jdur|js
||jvr|jd7_dS|jr|��g}|j�|�|jdur7||jvr7|||f|_dS|�|||�dSr�)	r�r�r7rAr�rPr�r�rV)r,r#rC�new_namespacesr!r!r"rDs
�
zC14NWriterTarget.startcs��jdur|r�fdd�|��D�}|h|�}i}|dur+��|�}||<|�|��jdurX|rX��|�}|rU|D]}	||	}
t|
�rS��|
�}||
<|�|�q;nd}nd}�j��fdd�t|dd�d�D�}|rzdd�|D�}|��ng}|r�t|���D]*\}
}|dur�|
|vr�||vr�|||d	}||
\}}	}|�	|r�|n|	|f�q�|�
d
�}�j�	|r�|dkn�jd��j}|d
||d	�|r�|d�
dd�|D���|d�|dur�|t|||d	��d�_�j�	g�dS)Ncs i|]\}}|�jvr||�qSr!)r���.0r�r�r0r!r"�
<dictcomp>�s z+C14NWriterTarget._start.<locals>.<dictcomp>csi|]}|�|��qSr!r!)r�r|)�parse_qnamer!r"r��scSs|�dd�S)Nr�r)r�)r|r!r!r"r��sz)C14NWriterTarget._start.<locals>.<lambda>r�cSs$g|]\}}|rd|nd|f�qS)zxmlns:Zxmlnsr!)r�r�r�r!r!r"�
<listcomp>�s��z+C14NWriterTarget._start.<locals>.<listcomp>rz+{http://www.w3.org/XML/1998/namespace}spaceZpreserverr�r�cSs&g|]\}}d|�dt|��d��qS)ruz="r�)�_escape_attrib_c14nr�r!r!r"r��s&r�T)r�rmr�r�r�r�r�r��sortrPrgr�r�r?r�r�r�)r,r#rCr�r�r�Zresolved_namesr�ZqattrsZ	attr_nameriZ
parsed_qnamesrtr�r�Z
attr_qnamer�Zspace_behaviourr�r!)r�r,r"rV�sb



��
��

�zC14NWriterTarget._startcCst|jr|jd8_dS|jr|��|�d|�|�d�d��|j��t|j�dk|_|j	��|j
��dS)Nrr�rr�)r�r7rAr�r�r�rEr>r�r�r�r�r!r!r"r'�s

zC14NWriterTarget.endcCsh|jsdS|jr
dS|jr|�d�n
|jr|jr|��|�dt|��d��|js2|�d�dSdS)Nr�z<!--z-->)r�r�r�r�r�r7rAr�r@r!r!r"rG�s�zC14NWriterTarget.commentcCst|jrdS|jr|�d�n
|jr|jr|��|�|r'd|�dt|��d�nd|�d��|js8|�d�dSdS)Nr�z<?ruz?>)r�r�r�r�r7rAr�)r,rvr�r!r!r"rH�s$��zC14NWriterTarget.pir3)rrr r.�reversedr�r�r�r�r?rArMrDrVr'rGrHr!r!r!r"r�s"�%
%
E
rc	Csxz+d|vr|�dd�}d|vr|�dd�}d|vr|�dd�}d|vr)|�dd�}|WSttfy;t|�YdSw)	Nr�r�r�r�r�r�r�&#xD;r�rwr!r!r"r��s�r�c	Cs�z?d|vr|�dd�}d|vr|�dd�}d|vr|�dd�}d|vr)|�dd�}d	|vr3|�d	d
�}d|vr=|�dd�}|WSttfyOt|�YdSw)
Nr�r�r�r�r�r�rz&#x9;r�z&#xA;rr�r�rwr!r!r"r�s"�r�)rn)�_set_factoriesr3rs)rr)@�__all__rr
r�r5r�r"Zcollections.abcr�r�rr+rrrrrr
rrr�contextmanagerr�r�r�r�rj�	NameErrorr�r�r�rr�r�r�r�r�rr�rrrrr
r	rrrrrrrr�compile�UNICODEr�r�rr�r�rVZ_elementtreer�rPr!r!r!r"�<module>s�H/

0e

1=2�2�	�
��

6
2
:

zn�