Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/xml/etree/ElementPath.pyc

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


�`^c@s�ddlZejd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zied6ed6ed
6e
d6e	d6ed6ZiZ
ddd��YZdd�Zdd�Zdd�Zddd�ZdS(i�NsY('[^']*'|"[^"]*"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccs�x�tj|�D]�}|d}|r�|ddkr�d|kr�yH|jdd�\}}|slt�n|dd|||ffVWq�tk
r�td|��q�Xq|VqWdS(Niit{t:s{%s}%ss!prefix %r not found in prefix map(txpath_tokenizer_retfindalltsplittKeyErrortSyntaxError(tpatternt
namespacesttokenttagtprefixturi((s+/sys/lib/python2.7/xml/etree/ElementPath.pytxpath_tokenizerIs
"	!
cCs^|j}|dkrZi|_}x5|jj�D]!}x|D]}|||<q?Wq2Wn|S(N(t
parent_maptNonetroottiter(tcontextRtpte((s+/sys/lib/python2.7/xml/etree/ElementPath.pytget_parent_mapWs	

cs|d��fd�}|S(Nic3s=x6|D].}x%|D]}|j�kr|VqqWqWdS(N(R
(RtresulttelemR(R
(s+/sys/lib/python2.7/xml/etree/ElementPath.pytselectbs

((tnextR	R((R
s+/sys/lib/python2.7/xml/etree/ElementPath.pyt
prepare_child`s
cCs
d�}|S(Ncss+x$|D]}x|D]}|VqWqWdS(N((RRRR((s+/sys/lib/python2.7/xml/etree/ElementPath.pyRjs

((RR	R((s+/sys/lib/python2.7/xml/etree/ElementPath.pytprepare_staris	cCs
d�}|S(Ncssx|D]}|VqWdS(N((RRR((s+/sys/lib/python2.7/xml/etree/ElementPath.pyRqs
((RR	R((s+/sys/lib/python2.7/xml/etree/ElementPath.pytprepare_selfps	csX|�}|ddkr"d�n#|ds9|d�ntd���fd�}|S(Nit*isinvalid descendantc3sCx<|D]4}x+|j��D]}||k	r|VqqWqWdS(N(R(RRRR(R
(s+/sys/lib/python2.7/xml/etree/ElementPath.pyR~s
(R(RR	R((R
s+/sys/lib/python2.7/xml/etree/ElementPath.pytprepare_descendantvs		

cCs
d�}|S(Ncss^t|�}i}xE|D]=}||kr||}||krVd||<|VqVqqWdS(N(RR(RRRt
result_mapRtparent((s+/sys/lib/python2.7/xml/etree/ElementPath.pyR�s


((RR	R((s+/sys/lib/python2.7/xml/etree/ElementPath.pytprepare_parent�s	
cs`g}g}x�|�}|ddkr,Pn|drd|dd dkrdd|ddd!f}n|j|dpwd�|j|d�qdj|�}|d	kr�|d��fd
�}|S|dkr�d�|d���fd�}|S|dkr=tjd
|d�r=|d��fd�}|S|dkr�tjd
|d�r�|d�|d���fd�}|S|dks�|dks�|dkrP|dkr�t|d�d�nl|ddkr�d��n|dkr7yt|d�d�Wq=tk
r3td��q=Xnd��fd�}|Std��dS(Nit]is'"t'i�t-ts@-c3s2x+|D]#}|j��dk	r|VqqWdS(N(tgetR(RRR(tkey(s+/sys/lib/python2.7/xml/etree/ElementPath.pyR�s
s@-='c3s2x+|D]#}|j���kr|VqqWdS(N(R&(RRR(R'tvalue(s+/sys/lib/python2.7/xml/etree/ElementPath.pyR�s
s\d+$c3s2x+|D]#}|j��dk	r|VqqWdS(N(tfindR(RRR(R
(s+/sys/lib/python2.7/xml/etree/ElementPath.pyR�s
s-='c3sSxL|D]D}x;|j��D]*}dj|j���kr|VPqqWqWdS(NR%(Rtjointitertext(RRRR(R
R((s+/sys/lib/python2.7/xml/etree/ElementPath.pyR�s

s-()s-()-tlastsunsupported functionisunsupported expressionc3syt|�}xf|D]^}y>||}t|j|j��}|�|krV|VnWqttfk
rpqXqWdS(N(RtlistRR
t
IndexErrorR(RRRRR telems(tindex(s+/sys/lib/python2.7/xml/etree/ElementPath.pyR�s

sinvalid predicate(tappendR*tretmatchtintRt
ValueError(RR	t	signaturet	predicateR((R0R'R
R(s+/sys/lib/python2.7/xml/etree/ElementPath.pytprepare_predicate�sV	


#
#

$
R%Rt.s..s//t[t_SelectorContextcBseZdZd�ZRS(cCs
||_dS(N(R(tselfR((s+/sys/lib/python2.7/xml/etree/ElementPath.pyt__init__�sN(t__name__t
__module__RRR=(((s+/sys/lib/python2.7/xml/etree/ElementPath.pyR;�sc	Csm|ddkr|d}nyt|}Wntk
r3tt�dkrZtj�n|d dkrytd��ntt||��j}|�}g}x�y"|jt	|d||��Wnt
k
r�td��nXy)|�}|ddkr
|�}nWq�t
k
r"Pq�Xq�|t|<nX|g}t|�}x|D]}|||�}qPW|S(	Ni�t/Ridis#cannot use absolute path on elementisinvalid path(t_cacheRtlentclearRRR
RR1topst
StopIterationR;(	RtpathRtselectorRR	RRR((s+/sys/lib/python2.7/xml/etree/ElementPath.pytiterfind�s:


	"
	
	
cCs3yt|||�j�SWntk
r.dSXdS(N(RHRRER(RRFR((s+/sys/lib/python2.7/xml/etree/ElementPath.pyR)s
cCstt|||��S(N(R-RH(RRFR((s+/sys/lib/python2.7/xml/etree/ElementPath.pyR$scCsBy)t|||�j�}|jp'dSWntk
r=|SXdS(NR%(RHRttextRE(RRFtdefaultR((s+/sys/lib/python2.7/xml/etree/ElementPath.pytfindtext*s

((R2tcompileRRR
RRRRRR!R8RDRAR;RHR)RRK(((s+/sys/lib/python2.7/xml/etree/ElementPath.pyt<module>;s.									
	P

$	

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.