Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/xml/etree/ElementTree.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
��c@s}dddddddddd	d
ddd
ddddgZddkZddkZddkZdfd��YZyddkZWnej
oe�ZnXdZdfd��YZeZ	hd�Z
hd�Zed�Z
ed�ZeZd
fd��YZdfd��YZd�Zd �Zd!�Zeid" d#joeid$�Zneied%��Zhd&d'<d(d)<d*d+<d,d-<Zhd.d/<d0d1<d2d3<d4d5<Zd6�Zed7�Zeeid8�Zeeid9�Zd:�Z ed;�Z!dfd<��YZ"d=�Z#d>�Z$e#Z%ed?�Z&d
fd@��YZ'dfdA��YZ(e(Z)dS(BtCommenttdumptElementtElementTreet
fromstringt	iselementt	iterparsetparsetPItProcessingInstructiontQNamet
SubElementttostringtTreeBuildertVERSIONtXMLt	XMLParsertXMLTreeBuilderi�Nt_SimpleElementPathcBs&eZd�Zdd�Zd�ZRS(cCs-x&|D]}|i|jo|SqqWdS(N(ttagtNone(tselftelementRtelem((s(/sys/lib/python/xml/etree/ElementTree.pytfindts
cCs7x0|D](}|i|jo|ipdSqqW|S(Nt(Rttext(RRRtdefaultR((s(/sys/lib/python/xml/etree/ElementTree.pytfindtextys
cCsb|d djo|i|d�Sng}x/|D]'}|i|jo|i|�q3q3W|S(Nis.//(tgetiteratorRtappend(RRRtresultR((s(/sys/lib/python/xml/etree/ElementTree.pytfindall~sN(t__name__t
__module__RRRR (((s(/sys/lib/python/xml/etree/ElementTree.pyRrs	s1.2.6t_ElementInterfacecBs�eZdZdZdZdZd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zdd�Zd�Zd�Zdd�Zd�Zd�Zd�Zdd�ZRS(cCs||_||_g|_dS(N(Rtattribt	_children(RRR$((s(/sys/lib/python/xml/etree/ElementTree.pyt__init__�s		cCsd|it|�fS(Ns<Element %s at %x>(Rtid(R((s(/sys/lib/python/xml/etree/ElementTree.pyt__repr__�scCs
t||�S(N(R(RRR$((s(/sys/lib/python/xml/etree/ElementTree.pytmakeelement�scCs
t|i�S(N(tlenR%(R((s(/sys/lib/python/xml/etree/ElementTree.pyt__len__�scCs|i|S(N(R%(Rtindex((s(/sys/lib/python/xml/etree/ElementTree.pyt__getitem__�scCs%t|�pt�||i|<dS(N(RtAssertionErrorR%(RR,R((s(/sys/lib/python/xml/etree/ElementTree.pyt__setitem__�scCs|i|=dS(N(R%(RR,((s(/sys/lib/python/xml/etree/ElementTree.pyt__delitem__�scCs|i||!S(N(R%(Rtstarttstop((s(/sys/lib/python/xml/etree/ElementTree.pyt__getslice__�scCs?x"|D]}t|�pt�qWt|�|i||+dS(N(RR.tlistR%(RR1R2telementsR((s(/sys/lib/python/xml/etree/ElementTree.pyt__setslice__	scCs|i||5dS(N(R%(RR1R2((s(/sys/lib/python/xml/etree/ElementTree.pyt__delslice__scCs(t|�pt�|ii|�dS(N(RR.R%R(RR((s(/sys/lib/python/xml/etree/ElementTree.pyRscCs+t|�pt�|ii||�dS(N(RR.R%tinsert(RR,R((s(/sys/lib/python/xml/etree/ElementTree.pyR8'scCs(t|�pt�|ii|�dS(N(RR.R%tremove(RR((s(/sys/lib/python/xml/etree/ElementTree.pyR94scCs|iS(N(R%(R((s(/sys/lib/python/xml/etree/ElementTree.pytgetchildren?scCsti||�S(N(tElementPathR(Rtpath((s(/sys/lib/python/xml/etree/ElementTree.pyRIscCsti|||�S(N(R;R(RR<R((s(/sys/lib/python/xml/etree/ElementTree.pyRWscCsti||�S(N(R;R (RR<((s(/sys/lib/python/xml/etree/ElementTree.pyR bscCs*|ii�g|_d|_|_dS(N(R$tclearR%RRttail(R((s(/sys/lib/python/xml/etree/ElementTree.pyR=is
	cCs|ii||�S(N(R$tget(RtkeyR((s(/sys/lib/python/xml/etree/ElementTree.pyR?wscCs||i|<dS(N(R$(RR@tvalue((s(/sys/lib/python/xml/etree/ElementTree.pytset�scCs
|ii�S(N(R$tkeys(R((s(/sys/lib/python/xml/etree/ElementTree.pyRC�scCs
|ii�S(N(R$titems(R((s(/sys/lib/python/xml/etree/ElementTree.pyRD�scCsyg}|djo
d}n|djp|i|jo|i|�nx'|iD]}|i|i|��qUW|S(Nt*(RRRR%textendR(RRtnodestnode((s(/sys/lib/python/xml/etree/ElementTree.pyR�s


N(R!R"RRR$RR>R&R(R)R+R-R/R0R3R6R7RR8R9R:RRR R=R?RBRCRDR(((s(/sys/lib/python/xml/etree/ElementTree.pyR#�s6
		
		
		
	
					
	
		
					
	
	cKs&|i�}|i|�t||�S(N(tcopytupdateR#(RR$textra((s(/sys/lib/python/xml/etree/ElementTree.pyR�s
cKs<|i�}|i|�|i||�}|i|�|S(N(RIRJR)R(tparentRR$RKR((s(/sys/lib/python/xml/etree/ElementTree.pyR�s


cCstt�}||_|S(N(RRR(RR((s(/sys/lib/python/xml/etree/ElementTree.pyR�s	cCs8tt�}||_|o|id||_n|S(Nt (RR	R(ttargetRR((s(/sys/lib/python/xml/etree/ElementTree.pyR	�s
	cBs/eZdd�Zd�Zd�Zd�ZRS(cCs(|od||f}n||_dS(Ns{%s}%s(R(Rttext_or_uriR((s(/sys/lib/python/xml/etree/ElementTree.pyR&scCs|iS(N(R(R((s(/sys/lib/python/xml/etree/ElementTree.pyt__str__
scCs
t|i�S(N(thashR(R((s(/sys/lib/python/xml/etree/ElementTree.pyt__hash__scCs7t|t�ot|i|i�Snt|i|�S(N(t
isinstanceR
tcmpR(Rtother((s(/sys/lib/python/xml/etree/ElementTree.pyt__cmp__sN(R!R"RR&RPRRRV(((s(/sys/lib/python/xml/etree/ElementTree.pyR
s		cBsteZddd�Zd�Zd�Zdd�Zdd�Zd�Zdd�Z	d�Z
dd	�Zd
�ZRS(cCsF|djpt|�pt�||_|o|i|�ndS(N(RRR.t_rootR(RRtfile((s(/sys/lib/python/xml/etree/ElementTree.pyR&s!	cCs|iS(N(RW(R((s(/sys/lib/python/xml/etree/ElementTree.pytgetroot*scCs!t|�pt�||_dS(N(RR.RW(RR((s(/sys/lib/python/xml/etree/ElementTree.pyt_setroot4scCs{t|d�pt|d�}n|p
t�}nx+|id�}|pPn|i|�q:|i�|_|iS(Ntreadtrbi�(thasattrtopenRR[tfeedtcloseRW(Rtsourcetparsertdata((s(/sys/lib/python/xml/etree/ElementTree.pyRAs
cCs'|idj	pt�|ii|�S(N(RWRR.R(RR((s(/sys/lib/python/xml/etree/ElementTree.pyRVscCsF|idj	pt�|d djod|}n|ii|�S(Nit/t.(RWRR.R(RR<((s(/sys/lib/python/xml/etree/ElementTree.pyRbscCsI|idj	pt�|d djod|}n|ii||�S(NiRdRe(RWRR.R(RR<R((s(/sys/lib/python/xml/etree/ElementTree.pyRtscCsF|idj	pt�|d djod|}n|ii|�S(NiRdRe(RWRR.R (RR<((s(/sys/lib/python/xml/etree/ElementTree.pyR �ssus-asciicCs�|idj	pt�t|d�pt|d�}n|p
d}n0|djo"|djo|id|�n|i||i|h�dS(Ntwritetwbsus-asciisutf-8s$<?xml version='1.0' encoding='%s'?>
(RWRR.R]R^Rft_write(RRXtencoding((s(/sys/lib/python/xml/etree/ElementTree.pyRf�s
cCsh|i}|tjo!|idt|i|��n|tjo!|idt|i|��n�|i�}g}yVt|t�p|d djo1t	||�\}}|o|i
|�q�nWntj
ot|�nX|idt
||��|p|oi|i�x|D]\}	}
yVt|	t�p|	d djo1t	|	|�\}	}|o|i
|�q�nWntj
ot|	�nXyEt|
t�o1t	|
|�\}
}|o|i
|�q�nWntj
ot|
�nX|idt
|	|�t|
|�f�q&WxA|D]5\}	}
|idt
|	|�t|
|�f�qAWn|ip
t|�o}|id�|io|it|i|��nx$|D]}|i||||�q�W|idt
||�d�n|id	�x|D]\}	}
||
=q&W|io|it|i|��ndS(
Ns<!-- %s -->s<?%s?>it{t<s %s="%s"t>s</s />(RRRft
_escape_cdataRR	RDRSR
tfixtagRt	TypeErrort_raise_serialization_errort_encodetsortt_escape_attribR*RhR>(RRXRHRit
namespacesRRDtxmlns_itemstxmlnstktvtn((s(/sys/lib/python/xml/etree/ElementTree.pyRh�sd	
!
!! 
!  

"

N(
R!R"RR&RYRZRRRRR RfRh(((s(/sys/lib/python/xml/etree/ElementTree.pyRs	
	
		
cCst|t�p
t|d�S(NR(RSR#R](R((s(/sys/lib/python/xml/etree/ElementTree.pyR�scCspt|t�pt|�}n|iti�|i�i}|p|ddjotiid�ndS(Ni�s
(RSRRftsyststdoutRYR>(RR>((s(/sys/lib/python/xml/etree/ElementTree.pyR�scCs/y|i|�SWntj
o|SnXdS(N(tencodetAttributeError(tsRi((s(/sys/lib/python/xml/etree/ElementTree.pyRq�sis1.5s[&<>\"\x80-\xff]+su"[&<>\"\u0080-\uffff]+"s&amp;t&s&lt;Rks&gt;Rls&quot;t"txmls$http://www.w3.org/XML/1998/namespacethtmlshttp://www.w3.org/1999/xhtmltrdfs+http://www.w3.org/1999/02/22-rdf-syntax-ns#twsdls http://schemas.xmlsoap.org/wsdl/cCs#td|t|�if��dS(Nscannot serialize %r (type %s)(RottypeR!(R((s(/sys/lib/python/xml/etree/ElementTree.pyRpscCsMtd�}yt|i||�d�SWntj
ot|�nXdS(NcSspg}|i}xN|i�D]@}|i|�}|djodt|�}n||�qWti|d�S(Ns&#%d;R(RtgroupR?Rtordtstringtjoin(tmtmaptoutRtcharR((s(/sys/lib/python/xml/etree/ElementTree.pytescape_entitiess	

tascii(t_escape_mapRqtsubRoRp(RtpatternR�((s(/sys/lib/python/xml/etree/ElementTree.pyt_encode_entitys
	c
Cs�y||o7yt||�}WqAtj
ot|�SqAXn||dd�}||dd�}||dd�}|SWn#ttfj
ot|�nXdS(NRs&amp;Rks&lt;Rls&gt;(RqtUnicodeErrorR�RoR}Rp(RRitreplace((s(/sys/lib/python/xml/etree/ElementTree.pyRm sc
Cs�y�|o7yt||�}WqAtj
ot|�SqAXn||dd�}||dd�}||dd�}||dd�}||d	d
�}|SWn#ttfj
ot|�nXdS(NRs&amp;t's&apos;s"s&quot;Rks&lt;Rls&gt;(RqR�R�RoR}Rp(RRiR�((s(/sys/lib/python/xml/etree/ElementTree.pyRs/scCs�t|t�o
|i}nti|ddd�\}}|i|�}|djoeti|�}|djodt|�}n|||<|djo
d}q�d||f}nd}d||f|fS(Nit}sns%dR�sxmlns:%ss%s:%s(	RSR
RR�tsplitR?Rt_namespace_mapR*(RRtt
namespace_uritprefixRv((s(/sys/lib/python/xml/etree/ElementTree.pyRn@s





cCst�}|i||�|S(N(RR(RaRbttree((s(/sys/lib/python/xml/etree/ElementTree.pyR\s	cBsMeZdd�Zd�Zyed�ZWnej
od�ZnXRS(cCs�t|d�pt|d�}n||_g|_d|_d|_|_t�|_	|i	i	}|ii
}|djo
dg}nx|D]	}|djory7d|_d|_|||i	i
d�}||_Wq�tj
o(|||i	id�}||_q�Xq�|djo%|||i	id	�}||_q�|d
jo||d�}||_q�|djo||d
�}||_q�q�WdS(NR[R\itendR1icSs|||||�f�dS(N((Rt	attrib_inteventRR1((s(/sys/lib/python/xml/etree/ElementTree.pythandler~scSs|||||�f�dS(N((RR�R�RR1((s(/sys/lib/python/xml/etree/ElementTree.pyR��scSs||||�f�dS(N((RR�RR�((s(/sys/lib/python/xml/etree/ElementTree.pyR��ssstart-nscSsJyt|d�}Wntj
onX|||pd|ff�dS(NR�R(RqR�(R�turiR�R((s(/sys/lib/python/xml/etree/ElementTree.pyR��s
send-nscSs||df�dS(N(R(R�R�R((s(/sys/lib/python/xml/etree/ElementTree.pyR��s(R]R^t_filet_eventst_indexRtrootRWRt_parserRtordered_attributestspecified_attributest_start_listtStartElementHandlerR}t_startt_endtEndElementHandlertStartNamespaceDeclHandlertEndNamespaceDeclHandler(RRateventsRbRR�R�((s(/sys/lib/python/xml/etree/ElementTree.pyR&lsD			


		





cCs�x�y|i|i}Wn�tj
o�|idjo6|i|_y
t�Wqntj
o
t�qnXn|i2d|_|i	i
d�}|o|ii|�q�|ii�|_d|_qX|id|_|SqdS(Nii@i(
R�R�t
IndexErrorR�RRWR�t
StopIterationt	NameErrorR�R[R_R`(RtitemRc((s(/sys/lib/python/xml/etree/ElementTree.pytnext�s&
	cCs|S(N((R((s(/sys/lib/python/xml/etree/ElementTree.pyt__iter__�scCs
|i�S(N(R�(RR,((s(/sys/lib/python/xml/etree/ElementTree.pyR-�sN(	R!R"RR&R�titerR�R�R-(((s(/sys/lib/python/xml/etree/ElementTree.pyRjs-	
cCs t�}|i|�|i�S(N(RR_R`(RRb((s(/sys/lib/python/xml/etree/ElementTree.pyR�s	
cCsmt�}|i|�|i�}h}x8|i�D]*}|id�}|o|||<q5q5W||fS(NR'(RR_R`RR?(RRbR�tidsRR'((s(/sys/lib/python/xml/etree/ElementTree.pytXMLID�s	

cCsTddd��Y}g}|�}|i|_t|�i||�ti|d�S(NtdummycBseZRS((R!R"(((s(/sys/lib/python/xml/etree/ElementTree.pyR��sR((RRfRR�R�(RRiR�RcRX((s(/sys/lib/python/xml/etree/ElementTree.pyR�s	cBsAeZdd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsHg|_g|_d|_d|_|djo
t}n||_dS(N(t_datat_elemRt_lastt_tailR#t_factory(Rtelement_factory((s(/sys/lib/python/xml/etree/ElementTree.pyR&s				

cCsAt|i�djp
td�|idjp
td�|iS(Nismissing end tagssmissing toplevel element(R*R�R.R�R(R((s(/sys/lib/python/xml/etree/ElementTree.pyR`s cCs�|io�|idj	oyti|id�}|io-|iidjp
td�||i_q�|iidjp
td�||i_ng|_ndS(NRsinternal error (tail)sinternal error (text)(	R�R�RR�R�R�R>R.R(RR((s(/sys/lib/python/xml/etree/ElementTree.pyt_flushs

cCs|ii|�dS(N(R�R(RRc((s(/sys/lib/python/xml/etree/ElementTree.pyRc(scCsb|i�|i||�|_}|io|idi|�n|ii|�d|_|S(Ni�i(R�R�R�R�RR�(RRtattrsR((s(/sys/lib/python/xml/etree/ElementTree.pyR13s

	cCsY|i�|ii�|_|ii|jptd|ii|f�d|_|iS(Ns&end tag mismatch (expected %s, got %s)i(R�R�tpopR�RR.R�(RR((s(/sys/lib/python/xml/etree/ElementTree.pyR�Cs
	N(	R!R"RR&R`R�RcR1R�(((s(/sys/lib/python/xml/etree/ElementTree.pyR
�s				cBsqeZddd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(
icCs?yddkl}Wntj
otd��nX|idd�|_}|djo
t�}n||_h|_|i	|_
|i|_|i
|_|i|_yd|i_Wntj
onXy(d|i_d|i_|i|_Wntj
onXd}|ip
d}nd|_h|_dS(Ni�(texpats7No module named expat; use SimpleXMLTreeBuilder insteadR�isutf-8(txml.parsersR�tImportErrortParserCreateRR�R
t_targett_namest_defaulttDefaultHandlerExpandR�R�R�R�R�tCharacterDataHandlertbuffer_textR}R�R�R�treturns_unicodet_doctypetentity(RR�RNR�RbRi((s(/sys/lib/python/xml/etree/ElementTree.pyR&Ys:

		

	cCs/yt|d�SWntj
o|SnXdS(NR�(RqR�(RR((s(/sys/lib/python/xml/etree/ElementTree.pyt_fixtext}scCsfy|i|}WnNtj
oB|}d|jod|}n|i|�|i|<}nX|S(NR�Rj(R�tKeyErrorR�(RR@tname((s(/sys/lib/python/xml/etree/ElementTree.pyt_fixname�s
cCsd|i}||�}h}x3|i�D]%\}}|i|�|||�<q(W|ii||�S(N(R�RDR�R�R1(RRR�tfixnameR$R@RA((s(/sys/lib/python/xml/etree/ElementTree.pyR��s	
cCs�|i}||�}h}|oLxItdt|�d�D]+}|i||d�||||�<q;Wn|ii||�S(Niii(R�trangeR*R�R�R1(RRR�R�R$ti((s(/sys/lib/python/xml/etree/ElementTree.pyR��s	-cCs|ii|i|��S(N(R�RcR�(RR((s(/sys/lib/python/xml/etree/ElementTree.pyR��scCs|ii|i|��S(N(R�R�R�(RR((s(/sys/lib/python/xml/etree/ElementTree.pyR��sc		Cs�|d }|djoty"|ii|i|dd!�Wq�tj
o?ddkl}|id||ii|ii	f��q�Xna|djo|d djo
g|_
n6|i
dj	o%|d	jod|_
dSnti
|�}|pdSn|i
i|�t|i
�}|d
jo�|i
d}|djo&|djo|i
\}}}}n;|d
jo)|djo|i
\}}}d}ndS|o|dd!}n|i|||dd!�d|_
q�ndS(NiRi�(R�s'undefined entity %s: line %d, column %dRki	s	<!DOCTYPERlitPUBLICitSYSTEMi(R�RcR�R�R�R�terrorR�tErrorLineNumbertErrorColumnNumberR�RR�tstripRR*tdoctype(	RRR�R�RyR�R�tpubidtsystem((s(/sys/lib/python/xml/etree/ElementTree.pyR��sB

"

	


cCsdS(N((RR�R�R�((s(/sys/lib/python/xml/etree/ElementTree.pyR��scCs|ii|d�dS(Ni(R�tParse(RRc((s(/sys/lib/python/xml/etree/ElementTree.pyR_�scCs2|iidd�|ii�}|`|`|S(NRi(R�R�R�R`(RR�((s(/sys/lib/python/xml/etree/ElementTree.pyR`�sN(R!R"RR&R�R�R�R�R�R�R�R�R_R`(((s(/sys/lib/python/xml/etree/ElementTree.pyRWs$								.			(*t__all__R�RztreRR;R�RR#t_ElementRRRRR	RR
RRRRqtversiontcompilet_escapetevalR�R�RpR�R�RmRsRnRRRR�RRR
RR(((s(/sys/lib/python/xml/etree/ElementTree.pys<module>Ksv$��											W	
	
X

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.