Your IP : 3.149.27.153


Current Path : /opt/alt/python39/lib64/python3.9/xml/etree/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/xml/etree/__pycache__/ElementTree.cpython-39.opt-2.pyc

a

R�f�"�@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�ZdZzee�ZWney�Yn0dd�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'daddd4d5�d:d;�Z(d<d=�Z)dbd?d@�Z*dcdAdB�Z+dddCdD�Z,GdEdF�dF�Z-dedGdH�Z.dfdIdJ�Z/e.Z0dgdKdL�Z1GdMdN�dN�Z2GdOdP�dP�Z3dhdddQ�dRdS�Z4e�5dTej6�j7Z8GdUdV�dV�Z9dWdX�Z:dYdZ�Z;zeZ<dd[l=Tdd\l=m>Z>Wne?�ytYn0e>ee�dS)i)�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@seZdZdS)rN)�__name__�
__module__�__qualname__�r!r!�:/opt/alt/python39/lib64/python3.9/xml/etree/ElementTree.pyrjs	rcCs
t|d�S)N�tag)�hasattr)�elementr!r!r"rxsrc@s�eZdZdZdZdZdZifdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd6d d!�Zd7d"d#�Zd8d$d%�Zd9d&d'�Zd(d)�Zd:d*d+�Zd,d-�Zd.d/�Zd0d1�Zd;d2d3�Zd4d5�Z dS)<rNcKs: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__�szElement.__repr__cCs|�||�S�N)r))r,r#r*r!r!r"�makeelement�s	zElement.makeelementcCst�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�<|Sr2)r3r#r*�text�tail)r,�elemr!r!r"r7�s
zElement.__copy__cCs
t|j�Sr2)�lenr+r0r!r!r"�__len__�szElement.__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)r4r5�
FutureWarningr<r+r0r!r!r"�__bool__�s
�zElement.__bool__cCs
|j|Sr2�r+�r,�indexr!r!r"�__getitem__�szElement.__getitem__cCs8t|t�r |D]}|�|�qn
|�|�||j|<dSr2)r&�slice�_assert_is_elementr+)r,rEr%�eltr!r!r"�__setitem__�s


zElement.__setitem__cCs|j|=dSr2rCrDr!r!r"�__delitem__�szElement.__delitem__cCs|�|�|j�|�dSr2�rHr+�append�r,�
subelementr!r!r"rM�s
zElement.appendcCs$|D]}|�|�|j�|�qdSr2rL)r,�elementsr%r!r!r"�extend�s
zElement.extendcCs|�|�|j�||�dSr2)rHr+�insert)r,rErOr!r!r"rRs
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r&�_Element_Pyr(�typer)r,�er!r!r"rHs
zElement._assert_is_elementcCs|j�|�dSr2)r+�removerNr!r!r"rVs
zElement.removecCst�|||�Sr2)r�find�r,�path�
namespacesr!r!r"rWs	zElement.findcCst�||||�Sr2)r�findtext�r,rY�defaultrZr!r!r"r[&szElement.findtextcCst�|||�Sr2)r�findallrXr!r!r"r^4s	zElement.findallcCst�|||�Sr2)r�iterfindrXr!r!r"r_?s	zElement.iterfindcCs |j��g|_d|_|_dSr2)r*�clearr+r9r:r0r!r!r"r`Js
z
Element.clearcCs|j�||�Sr2)r*�get)r,�keyr]r!r!r"raUszElement.getcCs||j|<dSr2)r*)r,rb�valuer!r!r"�setbszElement.setcCs
|j��Sr2)r*�keysr0r!r!r"relszElement.keyscCs
|j��Sr2)r*�itemsr0r!r!r"rfus	z
Element.itemsccsD|dkrd}|dus|j|kr$|V|jD]}|�|�EdHq*dS)N�*)r#r+�iter)r,r#rUr!r!r"rh�s
zElement.iterccsX|j}t|t�s|durdS|j}|r,|V|D]"}|��EdH|j}|r0|Vq0dSr2)r#r&�strr9�itertextr:)r,r#�trUr!r!r"rj�szElement.itertext)N)NN)N)N)N)N)!rrr r#r*r9r:r.r1r3r8r7r=rBrFrJrKrMrQrRrHrVrWr[r^r_r`rardrerfrhrjr!r!r!r"r}s<	








	
rcKs&i|�|�}|�||�}|�|�|Sr2)r3rM)�parentr#r*r-r%r!r!r"r�s
rcCstt�}||_|Sr2)rrr9)r9r%r!r!r"r�s	rcCs&tt�}||_|r"|jd||_|S)N� )rr
r9)�targetr9r%r!r!r"r
�s

r
c@sVeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rNcCs|rd||f}||_dS)Nz{%s}%s�r9)r,Ztext_or_urir#r!r!r"r.�szQName.__init__cCs|jSr2ror0r!r!r"�__str__�sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r)rr9r0r!r!r"r1�szQName.__repr__cCs
t|j�Sr2)�hashr9r0r!r!r"�__hash__�szQName.__hash__cCs t|t�r|j|jkS|j|kSr2�r&rr9�r,�otherr!r!r"�__le__�s
zQName.__le__cCs t|t�r|j|jkS|j|kSr2rsrtr!r!r"�__lt__�s
zQName.__lt__cCs t|t�r|j|jkS|j|kSr2rsrtr!r!r"�__ge__�s
zQName.__ge__cCs t|t�r|j|jkS|j|kSr2rsrtr!r!r"�__gt__s
zQName.__gt__cCs t|t�r|j|jkS|j|kSr2rsrtr!r!r"�__eq__s
zQName.__eq__)N)rrr r.rpr1rrrvrwrxryrzr!r!r!r"r�s
rc@szeZdZddd�Zdd�Zdd�Zddd	�Zdd
d�Zddd
�Zddd�Z	ddd�Z
d dd�Zd!dd�dd�Zdd�Z
dS)"rNcCs||_|r|�|�dSr2)�_rootr
)r,r%�filer!r!r"r.szElementTree.__init__cCs|jSr2�r{r0r!r!r"�getrootszElementTree.getrootcCs
||_dSr2r})r,r%r!r!r"�_setroot"szElementTree._setrootcCs�d}t|d�st|d�}d}zt|durVt�}t|d�rV|�|�|_|jW|rT|��S|�d�}|sfqr|�|�qV|��|_|jW|r�|��Sn|r�|��0dS)NF�read�rbT�_parse_wholei)r$�openrr�r{�closer��feed)r,�source�parser�close_source�datar!r!r"r
,s4


	�

��zElementTree.parsecCs|j�|�Sr2)r{rh�r,r#r!r!r"rhQs
zElementTree.itercCs:|dd�dkr,d|}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 %rr>r?)r4r5rAr{rWrXr!r!r"rW]s��zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|j�|||�Sr�)r4r5rAr{r[r\r!r!r"r[ss��zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|j�||�Sr�)r4r5rAr{r^rXr!r!r"r^�s��zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|j�||�Sr�)r4r5rAr{r_rXr!r!r"r_�s��zElementTree.iterfindT��short_empty_elementscCs�|s
d}n|tvrtd|��|s4|dkr0d}nd}t||���\}}|dkr~|sp|dur~|��dkr~|��dvr~|d|f�|d	kr�t||j�n,t|j|�\}	}
t|}|||j|	|
|d
�Wd�n1s�0YdS)N�xmlzunknown method %r�c14n�utf-8�us-ascii�unicode)r�r�z$<?xml version='1.0' encoding='%s'?>
r9r�)�
_serialize�
ValueError�_get_writer�lower�_serialize_textr{�_namespaces)r,�file_or_filename�encoding�xml_declaration�default_namespace�methodr��writeZdeclared_encoding�qnamesrZZ	serializer!r!r"r��s4�
�
���zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r,r|r!r!r"�
write_c14n�szElementTree.write_c14n)NN)N)N)N)NN)N)N)NNNN)rrr r.r~rr
rhrWr[r^r_r�r�r!r!r!r"r
s"


%




��5rccs^z
|j}Wn^tyh|��dkr(d}t|d|dd��}|j|fVWd�n1sZ0YYn�0|��dkr�|t|dd�p�dfVn�t����}t|tj	�r�|}nft|tj
�r�t�|�}|�|j
�nBt�	�}dd�|_||_z|j|_|j|_Wnt�yYn0tj||dd	d
�}|�|j
�|j|fVWd�n1�sP0YdS)Nr�r��w�xmlcharrefreplace)r��errorsr�cSsdS�NTr!r!r!r!r"�<lambda>�z_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��sB
�0


�r�csddi�i��rd��<���fdd�}|��D]�}|j}t|t�rZ|j�vr�||j�n<t|t�rv|�vr�||�n |dur�|tur�|tur�t|�|�	�D]F\}}t|t�r�|j}|�vr�||�t|t�r�|j�vr�||j�q�|j}t|t�r0|j�vr0||j�q0��fS)N�cs�z�|dd�dkr�|dd��dd�\}}��|�}|durjt�|�}|durZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wnty�t|�Yn0dS)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitra�_namespace_mapr<r�r(�_raise_serialization_error)�qname�urir#�prefix�r�rZr�r!r"�	add_qname.s(


�z_namespaces.<locals>.add_qname)
rhr#r&rr9rirrr�rf)r;r�r�r#rbrcr9r!r�r"r�#s4




r�cKs�|j}|j}|tur$|d|��nv|tur<|d|��n^||}|dur||r\|t|��|D]}t|||d|d�q`�n|d|�t|���}	|	s�|�r2|r�t|��dd�d�D](\}
}|r�d|}|d	|t	|
�f�q�|	D]L\}}
t
|t�r�|j}t
|
t��r||
j}
nt	|
�}
|d
|||
f�q�|�sHt|��sH|�s�|d�|�rb|t|��|D]}t|||d|d��qf|d|d�n|d
�|j
�r�|t|j
��dS)N�	<!--%s-->�<?%s?>r��<cSs|dS�Nrr!��xr!r!r"r�vr�z _serialize_xml.<locals>.<lambda>�rb�:�
 xmlns%s="%s"� %s="%s"�>�</z />)r#r9rr
�
_escape_cdata�_serialize_xml�listrf�sorted�_escape_attribr&rr<r:)r�r;r�rZr��kwargsr#r9rUrf�v�kr!r!r"r�`s\
�
��


�
r�)
Zarea�baseZbasefont�br�col�frameZhrZimg�inputZisindex�link�metaZparamcKs�|j}|j}|tur(|dt|���n�|turD|dt|���nh||}|dur�|rd|t|��|D]}t|||d�qh�n,|d|�t|���}|s�|�r8|r�t|��dd�d�D](\}	}
|
r�d|
}
|d|
t	|	�f�q�|D]N\}
}	t
|
t��r|
j}
t
|	t��r||	j}	nt|	�}	|d	||
|	f�q�|d
�|�
�}|�rx|dk�sb|dk�rl||�n|t|��|D]}t|||d��q||tv�r�|d
|d
�|j�r�|t|j��dS)Nr�r�r�cSs|dSr�r!r�r!r!r"r��r�z!_serialize_html.<locals>.<lambda>r�r�r�r�r�ZscriptZstyler�)r#r9rr�r
�_serialize_htmlr�rfr�r�r&r�_escape_attrib_htmlr��
HTML_EMPTYr:)r�r;r�rZr�r#r9rUrfr�r�Zltagr!r!r"r��sX
��


r�cCs*|��D]}||�q|jr&||j�dSr2)rjr:)r�r;�partr!r!r"r��s
r�)r��htmlr9cCsLt�d|�rtd��tt���D]\}}||ks8||kr t|=q |t|<dS)Nzns\d+$z'Prefix format reserved for internal use)�re�matchr�r�r�rf)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��dS)Nzcannot serialize %r (type %s))r(rTrror!r!r"r��s�r�c	CsfzBd|vr|�dd�}d|vr*|�dd�}d|vr>|�dd�}|WSttfy`t|�Yn0dS)N�&�&amp;r��&lt;r��&gt;��replacer(r�r�ror!r!r"r�sr�c	Cs�z�d|vr|�dd�}d|vr*|�dd�}d|vr>|�dd�}d|vrR|�dd�}d	|vrf|�d	d
�}d|vrz|�dd�}d
|vr�|�d
d�}|WSttfy�t|�Yn0dS)Nr�r�r�r�r�r��"�&quot;�
z&#13;r�z&#10;�	z&#09;r�ror!r!r"r�s$r�c	CsfzBd|vr|�dd�}d|vr*|�dd�}d|vr>|�dd�}|WSttfy`t|�Yn0dS)Nr�r�r�r�r�r�r�ror!r!r"r�.sr�T)r�r�r�cCs:|dkrt��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@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_ListDataStreamcCs
||_dSr2)�lst)r,r�r!r!r"r.Wsz_ListDataStream.__init__cCsdSr�r!r0r!r!r"r�Zsz_ListDataStream.writablecCsdSr�r!r0r!r!r"r�]sz_ListDataStream.seekablecCs|j�|�dSr2)r�rM)r,�br!r!r"r�`sz_ListDataStream.writecCs
t|j�Sr2)r<r�r0r!r!r"r�csz_ListDataStream.tellN)rrr r.r�r�r�r�r!r!r!r"r�Us
r�cCs*g}t|�}t|�j||||||d�|S)Nr�)r�rr�)r%r�r�r�r�r�r�r�r!r!r"rfs�rcCsLt|t�st|�}|jtjdd�|��j}|r<|ddkrHtj�d�dS)Nr�)r����r�)r&rr��sys�stdoutr~r:)r;r:r!r!r"rss

r�  cs`t|t�r|��}|dkr(td|����t|�s4dSd|�g����fdd���|d�dS)Nrz,Initial indentation level must be >= 0, got r�cs�|d}z�|}Wn(ty<�|�}��|�Yn0|jrN|j��sT||_|D],}t|�rn�||�|jr~|j��sX||_qX|j��s��||_dSr�)�
IndexErrorrMr9�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
rcCst�}|�||�|Sr2)rr
)r�r�rr!r!r"r
�s	r
csPt||d����fdd��G��fdd�dtjj�}|��d�_�~t���S)N)�events�_parserc3s�d}ztt|d�st|d�}d}dV���EdH|�d�}|sBqN��|�q$���}���EdH|�_W|r�|��n|r�|��0dS)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!)r
r�r!r"�IterParseIterator�sr)r�collections�abc�Iteratorr
�next)r�rr�rr!)rr
rr�r"r	�sr	c@sDeZdZddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdS)rN)rcCs<t��|_|ptt�d�|_|dur(d}|j�|j|�dS)N�rn)�end)r�deque�
_events_queuerrr�
_setevents)r,rrr!r!r"r.�s

zXMLPullParser.__init__c
Cs\|jdurtd��|rXz|j�|�Wn0tyV}z|j�|�WYd}~n
d}~00dS)Nz!feed() called after end of stream)rr�r��SyntaxErrorrrM)r,r��excr!r!r"r�
s
zXMLPullParser.feedcCs|j��}d|_|Sr2)rr�)r,r
r!r!r"r	s
z$XMLPullParser._close_and_return_rootcCs|��dSr2)r	r0r!r!r"r�szXMLPullParser.closeccs.|j}|r*|��}t|t�r"|�q|VqdSr2)r�popleftr&�	Exception)r,r�eventr!r!r"r"s
zXMLPullParser.read_eventscCs |jdurtd��|j��dS)Nz"flush() called after end of stream)rr��flushr0r!r!r"r0s
zXMLPullParser.flush)N)	rrr r.r�r	r�rrr!r!r!r"r�s
rcCs"|stt�d�}|�|�|��S�Nr�rrr�r�)r9r�r!r!r"r6s
rcCsR|stt�d�}|�|�|��}i}|��D]}|�d�}|r.|||<q.||fS)Nrr/)rrr�r�rhra)r9r�rZidsr;r/r!r!r"rGs



rcCs,|stt�d�}|D]}|�|�q|��Srr )Zsequencer�r9r!r!r"r_s
	rc@sdeZdZdddddd�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|_|dur*t}||_||_|durBt}||_	||_
|durZt}||_dSr2)
�_data�_elem�_lastr{�_tailr�_comment_factoryr#r
�_pi_factoryr$r�_factory)r,Zelement_factoryr!r"r#r$r!r!r"r.�s zTreeBuilder.__init__cCs|jSr2r}r0r!r!r"r��szTreeBuilder.closecCs>|jr:|jdur4d�|j�}|jr,||j_n||j_g|_dS�Nr�)r%r'�joinr(r:r9�r,r9r!r!r"�_flush�s

zTreeBuilder._flushcCs|j�|�dSr2)r%rM�r,r�r!r!r"r��szTreeBuilder.datacCsX|��|�||�|_}|jr2|jd�|�n|jdurB||_|j�|�d|_|S)Nr�r)r/r+r'r&rMr{r()r,r#�attrsr;r!r!r"�start�s
zTreeBuilder.startcCs |��|j��|_d|_|jSr�)r/r&�popr'r(r�r!r!r"r�szTreeBuilder.endcCs|�|j|j|�Sr2)�_handle_singler)r#r.r!r!r"�comment�s
�zTreeBuilder.commentcCs|�|j|j||�Sr2)r4r*r$)r,rnr9r!r!r"�pi�s�zTreeBuilder.picGs:||�}|r6|��||_|jr0|jd�|�d|_|S)Nr�r)r/r'r&rMr()r,�factoryrR�argsr;r!r!r"r4�szTreeBuilder._handle_single)N)N)rrr r.r�r/r�r2rr5r6r4r!r!r!r"rqs�
	rc@steZdZddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rN)rnr�cCs^zddlm}Wn:tyJzddl}WntyDtd��Yn0Yn0|�|d�}|durft�}||_|_||_|_	|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|_ d|_!i|_"zd
|j#|_$Wnt%�yXYn0dS)Nr��expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r2r�start_ns�end_nsr�r5r6rzExpat %d.%d.%d)&�xml.parsersr:�ImportErrorZpyexpatZParserCreaterr�rrn�_target�error�_error�_names�_defaultZDefaultHandlerExpandr$�_start�StartElementHandler�_end�EndElementHandler�	_start_ns�StartNamespaceDeclHandler�_end_ns�EndNamespaceDeclHandlerr�ZCharacterDataHandlerr5�CommentHandlerr6�ProcessingInstructionHandlerZbuffer_text�ordered_attributes�specified_attributes�_doctype�entity�version_info�versionr�)r,rnr�r:r�r!r!r"r.�sP�




zXMLParser.__init__cCs8|j}|j}|D�] }|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�t|j	d�r�|||j
fd	d�}n||fd
d�}||_q|dkr�t|j	d�r�|||jfd
d�}n||fdd�}||_
q|dk�r|||fdd�}||_q|dk�r&|||fdd�}||_qtd|��qdS)Nr2rcSs|||||�f�dSr2r!)r#Z	attrib_inrrMr2r!r!r"�handler0sz%XMLParser._setevents.<locals>.handlerrcSs||||�f�dSr2r!)r#rrMrr!r!r"rT5szstart-nsr;cSs|||||�f�dSr2r!)r�r�rrMr;r!r!r"rT<scSs|||p
d|pdff�dSr,r!)r�r�rrMr!r!r"rT@szend-nsr<cSs||||�f�dSr2r!)r�rrMr<r!r!r"rTFscSs||df�dSr2r!)r�rrMr!r!r"rTJsr5cSs|||j�|�f�dSr2)rnr5)r9rrMr,r!r!r"rTNsr6cSs|||j�||�f�dSr2)rnr6)Z	pi_targetr�rrMr,r!r!r"rTRszunknown event %r)rrMrNrOrDrErFrGr$rnrHrIrJrKrLrMr�)r,Zevents_queueZevents_to_reportr�rMZ
event_namerTr!r!r"r#sL
�
�
��

�
zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dSr2)r�code�lineno�offsetZposition)r,rc�errr!r!r"�_raiseerrorYszXMLParser._raiseerrorcCsDz|j|}Wn0ty>|}d|vr0d|}||j|<Yn0|S)Nr�r�)rB�KeyError)r,rb�namer!r!r"�_fixname_szXMLParser._fixnamecCs|j�|pd|pd�Sr,)rnr;�r,r�r�r!r!r"rHjszXMLParser._start_nscCs|j�|pd�Sr,)rnr<)r,r�r!r!r"rJmszXMLParser._end_nscCsR|j}||�}i}|rDtdt|�d�D]}||d||||�<q&|j�||�S)Nrr>r)r\�ranger<rnr2)r,r#�	attr_listZfixnamer*�ir!r!r"rDpszXMLParser._startcCs|j�|�|��Sr2)rnrr\r�r!r!r"rF|szXMLParser._endc	Cs�|dd�}|dkr�z|jj}Wnty4YdS0z||j|dd��WnXty�ddlm}|�d||jj	|jj
f�}d|_|jj	|_|jj
|_
|�Yn0�n"|dkr�|dd	�d
kr�g|_�n|jdu�r�|dkr�d|_dS|��}|�sdS|j�|�t|j�}|dk�r�|jd}|d
k�r`|dk�r`|j\}}}	}
|	�r�|	dd�}	n*|dk�r�|dk�r�|j\}}}
d}	ndSt|jd��r�|j�||	|
dd��nt|d��r�t�dt�d|_dS)Nrr�r�rr9z'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�r>ZPUBLIC�ZSYSTEM��doctypezaThe doctype() method of XMLParser is ignored.  Define doctype() method on the TreeBuilder target.)rnr�r�rQrZr=r:r@r�ZErrorLineNumberZErrorColumnNumberrUrVrWrPr�rMr<r$rer4r5�RuntimeWarning)r,r9r�Zdata_handlerr:rX�nrTr[Zpubid�systemr!r!r"rCsd���





�zXMLParser._defaultc
CsHz|j�|d�Wn0|jyB}z|�|�WYd}~n
d}~00dS)NF)r��ParserArY)r,r�r�r!r!r"r��szXMLParser.feedc
Cs�z|j�dd�Wn0|jyB}z|�|�WYd}~n
d}~00zLz|jj}WntydYn0|�W|`|`|`|`SW|`|`|`|`n|`|`|`|`0dS)Nr�T)	r�rirArYrnr�r�rr?)r,r�Z
close_handlerr!r!r"r��s  �
�zXMLParser.closec
Cs~|j��}z`z|j�d�|j�dd�Wn0|jyZ}z|�|�WYd}~n
d}~00W|j�|�n|j�|�0dS)NFr�)r�ZGetReparseDeferralEnabledZSetReparseDeferralEnabledrirArY)r,Zwas_enabledr�r!r!r"r�s
"zXMLParser.flush)rrr r.rrYr\rHrJrDrFrCr�r�rr!r!r!r"r�s
.66r)�out�	from_filecKs�|dur|durtd��d}|dur0t��}}tt|jfi|��d�}|durd|�|�|��n|durxt||d�|dur�|�	�SdS)Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r�)
r�r�r�rrr�r�r�r
r�)Zxml_datarjrkZoptionsZsior�r!r!r"r�s


rz	^\w+:\w+$c@s�eZdZdddddddd�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|_||_||_|r$t|�nd|_|r6t|�nd|_||_|rRt|�|_nd|_|rjt|�j	|_
nd|_
dgg|_g|_|s�|j�
tt����|j�
g�i|_dg|_d|_d|_d|_d|_dS)N)r�r�Fr)�_writer%�_with_comments�_strip_textrd�_exclude_attrs�
_exclude_tags�_rewrite_prefixes�_qname_aware_tags�intersection�_find_qname_aware_attrs�_declared_ns_stack�	_ns_stackrMr�r�rf�_prefix_map�_preserve_space�_pending_start�
_root_seen�
_root_done�_ignored_depth)	r,r�rlrmrnrorprqrrr!r!r"r.s2�zC14NWriterTarget.__init__ccs ||�D]}|r|EdHqdSr2r!)r,Zns_stackZ	_reversedrZr!r!r"�_iter_namespaces6sz!C14NWriterTarget._iter_namespacescCs\|�dd�\}}|�|j�D]$\}}||krd|�d|��Sqtd|�d|�d���dS)Nr�rr�r�zPrefix z of QName "�" is not declared in scope)�splitr�r}r�)r,Z
prefixed_namer�r[r��pr!r!r"�_resolve_prefix_name;s
z%C14NWriterTarget._resolve_prefix_namecCs�|dur:|dd�dkr,|dd��dd�nd|f\}}n|}t�}|�|j�D]B\}}||kr�||vr�|rz|�d|��n|||fS|�|�qP|jr�||jvr�|j|}ndt|j���}|j|<|jd�||f�|�d|��||fS|�sd|v�r|||fS|�|j	�D]J\}}||k�r|jd�||f�|�rR|�d|��n|||fS�q|�st|||fSt
d|�d	���dS)
Nrr�r�r�r�rgr�zNamespace "r�)r�rdr�r|�addrxr~r<rMr}r�)r,r�r�r#Z
prefixes_seen�ur�r!r!r"�_qnameBs.2 


&
zC14NWriterTarget._qnamecCs|js|j�|�dSr2)r�r%rMr0r!r!r"r�gszC14NWriterTarget.datar�cCs�||j�}|jdd�=|jr.|jds.|��}|jdurz|jd}|_|rVt|�rV|nd}|jg|�|�R�|durzdS|r�|jr�|�t	|��dS�Nr�)
r%rurr�r��_looks_like_prefix_namerDr�rs�_escape_cdata_c14n)r,Z
_join_textr�r8�
qname_textr!r!r"r/ks


zC14NWriterTarget._flushcCs0|jr
dS|jr|��|jd�||f�dSr�)r�r%r/r}rMr]r!r!r"r;ys
zC14NWriterTarget.start_nscCs�|jdur,|js||jvr,|jd7_dS|jr:|��g}|j�|�|jdurn||jvrn|||f|_dS|�|||�dSr�)	rwr�r%r/r|rMryr�rD)r,r#r1�new_namespacesr!r!r"r2�s
��zC14NWriterTarget.startcs�jdur$|r$�fdd�|��D�}|h|�}i}|durV��|�}||<|�|��jdur�|r���|�}|r�|D]0}	||	}
t|
�rv��|
�}||
<|�|�qvq�d}nd}�j��fdd�t|dd�d�D�}|r�dd�|D�}|��ng}|�rjt|���D]^\}
}|du�r@|
|v�r@||v�r@|||d	}||
\}}	}|�	|�r\|n|	|f��q
|�
d
�}�j�	|�r�|dkn�jd��j}|d
||d	�|�r�|d�
dd�|D���|d�|du�r�|t|||d	��d�_�j�	g�dS)Ncs i|]\}}|�jvr||�qSr!)rv��.0r�r�r0r!r"�
<dictcomp>�r�z+C14NWriterTarget._start.<locals>.<dictcomp>csi|]}|�|��qSr!r!)r�rg)�parse_qnamer!r"r��r�cSs|�dd�S)Nr�r)r�)rgr!r!r"r��r�z)C14NWriterTarget._start.<locals>.<lambda>r�cSs$g|]\}}|rd|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)rmz="r�)�_escape_attrib_c14nr�r!r!r"r��r�r�T)rvrfr�r�r{r�r�r��sortrMrarrsr-r�r�r})r,r#r1r�r�r�Zresolved_namesr�ZqattrsZ	attr_namercZ
parsed_qnamesr_r�r�Z
attr_qnamer�Zspace_behaviourr�r!)r�r,r"rD�s^


�
�

�
zC14NWriterTarget._startcCst|jr|jd8_dS|jr&|��|�d|�|�d�d��|j��t|j�dk|_|j	��|j
��dS)Nrr�rr�)r�r%r/rsr�rr3r<r�r|r}r�r!r!r"r�s

zC14NWriterTarget.endcCsd|js
dS|jrdS|jr&|�d�n|jr:|jr:|��|�dt|��d��|js`|�d�dS)Nr�z<!--z-->)rtr�r�rsr�r%r/r�r.r!r!r"r5�szC14NWriterTarget.commentcCsp|jr
dS|jr|�d�n|jr0|jr0|��|�|rNd|�dt|��d�n
d|�d��|jsl|�d�dS)Nr�z<?rmz?>)r�r�rsr�r%r/r�)r,rnr�r!r!r"r6�s$�zC14NWriterTarget.pi)N)N)rrr r.�reversedr�r�r�r�r-r/r;r2rDrr5r6r!r!r!r"r�s�%
%
E
rc	CszzVd|vr|�dd�}d|vr*|�dd�}d|vr>|�dd�}d|vrR|�dd�}|WSttfytt|�Yn0dS)	Nr�r�r�r�r�r�r��&#xD;r�ror!r!r"r��sr�c	Cs�z~d|vr|�dd�}d|vr*|�dd�}d|vr>|�dd�}d|vrR|�dd�}d	|vrf|�d	d
�}d|vrz|�dd�}|WSttfy�t|�Yn0dS)
Nr�r�r�r�r�r�r�z&#x9;r�z&#xA;r�r�r�ror!r!r"r�s r�)rg)�_set_factories)N)N)N)NN)NN)r�r)N)NN)N)N)N)N)@�__all__rr�r�r4r�r�collections.abcr�r�rrrrrrrr
rrr�contextmanagerr�r�r�r�rd�	NameErrorr�r�r�rr�r�r�r�r�rr�r�rrrr
r	rrrrrrrr�compile�UNICODEr�r�rr�r�rSZ_elementtreer�r>r!r!r!r"�<module>Is�/

0e
1
=22�	�
��

6

2:


zp

?>