AlkantarClanX12

Your IP : 3.144.2.5


Current Path : /usr/lib64/python3.6/lib2to3/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/lib2to3/__pycache__/pytree.cpython-36.opt-2.pyc

3


 \�m�@s�dZddlZddlZddlmZdZiadd�ZGdd�de�Z	Gd	d
�d
e	�Z
Gdd�de	�Zd
d�ZGdd�de�Z
Gdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�Zdd�ZdS)z#Guido van Rossum <guido@python.org>�N)�StringIOi���cCsHts<ddlm}x*|jj�D]\}}t|�tkr|t|<qWtj||�S)N�)�python_symbols)�_type_reprsZpygramr�__dict__�items�type�int�
setdefault)Ztype_numr�name�val�r
�&/usr/lib64/python3.6/lib2to3/pytree.py�	type_reprsrc@s�eZdZdZdZfZdZdZdd�Zdd�Z	dZ
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zdd�Zdd�Zedd��Zedd��Zdd�Zdd�Zdd �Zejd%kr�d#d$�ZdS)&�BaseNFcOs
tj|�S)N)�object�__new__)�cls�args�kwdsr
r
rr2szBase.__new__cCs|j|jk	rtS|j|�S)N)�	__class__�NotImplemented�_eq)�self�otherr
r
r�__eq__7szBase.__eq__cCst�dS)N)�NotImplementedError)rrr
r
rrCs	zBase._eqcCst�dS)N)r)rr
r
r�cloneNsz
Base.clonecCst�dS)N)r)rr
r
r�
post_orderVszBase.post_ordercCst�dS)N)r)rr
r
r�	pre_order^szBase.pre_ordercCs�t|t�s|g}g}d}x:|jjD].}||krF|dk	r@|j|�d}q"|j|�q"W|jj�||j_x|D]}|j|_qlWd|_dS)NFT)�
isinstance�list�parent�children�extend�append�changed)r�newZ
l_children�found�ch�xr
r
r�replacefs



zBase.replacecCs.|}x"t|t�s&|jsdS|jd}qW|jS)Nr)r �Leafr#�lineno)r�noder
r
r�
get_lineno}szBase.get_linenocCs|jr|jj�d|_dS)NT)r"r&�was_changed)rr
r
rr&�s
zBase.changedcCsJ|jrFx>t|jj�D].\}}||kr|jj�|jj|=d|_|SqWdS)N)r"�	enumerater#r&)r�ir.r
r
r�remove�s

zBase.removecCsZ|jdkrdSxFt|jj�D]6\}}||kry|jj|dStk
rPdSXqWdS)Nr)r"r1r#�
IndexError)rr2�childr
r
r�next_sibling�s
zBase.next_siblingcCsP|jdkrdSx<t|jj�D],\}}||kr|dkr8dS|jj|dSqWdS)Nrr)r"r1r#)rr2r5r
r
r�prev_sibling�s
zBase.prev_siblingccs"x|jD]}|j�EdHqWdS)N)r#�leaves)rr5r
r
rr8�szBase.leavescCs|jdkrdSd|jj�S)Nrr)r"�depth)rr
r
rr9�s
z
Base.depthcCs|j}|dkrdS|jS)N�)r6�prefix)rZnext_sibr
r
r�
get_suffix�szBase.get_suffix�rcCst|�jd�S)N�ascii)�str�encode)rr
r
r�__str__�szBase.__str__)r=r)�__name__�
__module__�__qualname__rr"r#r0Zwas_checkedrr�__hash__rrrrr+r/r&r3�propertyr6r7r8r9r<�sys�version_inforAr
r
r
rr s.
	


rc@s�eZdZddd�Zdd�Zdd�Zejdkr0eZd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zee
e�Zdd�Zdd�Zdd�ZdS)�NodeNcCsR||_t|�|_x|jD]
}||_qW|dk	r4||_|rH|dd�|_nd|_dS)N)rr!r#r"r;�fixers_applied)rrr#�contextr;rJr)r
r
r�__init__�s


z
Node.__init__cCsd|jjt|j�|jfS)Nz
%s(%s, %r))rrBrrr#)rr
r
r�__repr__�sz
Node.__repr__cCsdjtt|j��S)Nr:)�join�mapr?r#)rr
r
r�__unicode__�szNode.__unicode__r=rcCs|j|jf|j|jfkS)N)rr#)rrr
r
rr�szNode._eqcCst|jdd�|jD�|jd�S)NcSsg|]}|j��qSr
)r)�.0r)r
r
r�
<listcomp>szNode.clone.<locals>.<listcomp>)rJ)rIrr#rJ)rr
r
rrsz
Node.cloneccs(x|jD]}|j�EdHqW|VdS)N)r#r)rr5r
r
rrszNode.post_orderccs(|Vx|jD]}|j�EdHqWdS)N)r#r)rr5r
r
rr
szNode.pre_ordercCs|js
dS|jdjS)Nr:r)r#r;)rr
r
r�_prefix_getterszNode._prefix_gettercCs|jr||jd_dS)Nr)r#r;)rr;r
r
r�_prefix_setterszNode._prefix_settercCs(||_d|j|_||j|<|j�dS)N)r"r#r&)rr2r5r
r
r�	set_child!s
zNode.set_childcCs ||_|jj||�|j�dS)N)r"r#�insertr&)rr2r5r
r
r�insert_child+szNode.insert_childcCs||_|jj|�|j�dS)N)r"r#r%r&)rr5r
r
r�append_child4szNode.append_child)NNN)r=r)rBrCrDrLrMrPrGrHrArrrrrSrTrFr;rUrWrXr
r
r
rrI�s"



	rIc@s�eZdZdZdZdZddgfdd�Zdd�Zdd	�Ze	j
dkrBeZdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zeee�ZdS)r,r:rNcCsF|dk	r|\|_\|_|_||_||_|dk	r4||_|dd�|_dS)N)�_prefixr-�columnr�valuerJ)rrr[rKr;rJr
r
rrLGsz
Leaf.__init__cCsd|jj|j|jfS)Nz
%s(%r, %r))rrBrr[)rr
r
rrMZsz
Leaf.__repr__cCs|jt|j�S)N)r;r?r[)rr
r
rrP`szLeaf.__unicode__r=cCs|j|jf|j|jfkS)N)rr[)rrr
r
rrkszLeaf._eqcCs$t|j|j|j|j|jff|jd�S)N)rJ)r,rr[r;r-rZrJ)rr
r
rros
z
Leaf.cloneccs
|VdS)Nr
)rr
r
rr8uszLeaf.leavesccs
|VdS)Nr
)rr
r
rrxszLeaf.post_orderccs
|VdS)Nr
)rr
r
rr|szLeaf.pre_ordercCs|jS)N)rY)rr
r
rrS�szLeaf._prefix_gettercCs|j�||_dS)N)r&rY)rr;r
r
rrT�szLeaf._prefix_setter)r=r)rBrCrDrYr-rZrLrMrPrGrHrArrr8rrrSrTrFr;r
r
r
rr,>s$
r,cCsN|\}}}}|s||jkr<t|�dkr.|dSt|||d�St|||d�SdS)Nrr)rK)Z
number2symbol�lenrIr,)ZgrZraw_noderr[rKr#r
r
r�convert�sr]c@sLeZdZdZdZdZdd�Zdd�Zdd�Zddd	�Z	dd
d�Z
dd
�ZdS)�BasePatternNcOs
tj|�S)N)rr)rrrr
r
rr�szBasePattern.__new__cCsLt|j�|j|jg}x|r.|ddkr.|d=qWd|jjdjtt|��fS)Nrz%s(%s)z, ���r_)	rr�contentrrrBrNrO�repr)rrr
r
rrM�s
zBasePattern.__repr__cCs|S)Nr
)rr
r
r�optimize�szBasePattern.optimizecCsn|jdk	r|j|jkrdS|jdk	rRd}|dk	r4i}|j||�sDdS|rR|j|�|dk	rj|jrj|||j<dS)NFT)rr`�	_submatch�updater)rr.�results�rr
r
r�match�s


zBasePattern.matchcCs t|�dkrdS|j|d|�S)NrFr)r\rg)r�nodesrer
r
r�	match_seq�szBasePattern.match_seqccs&i}|r"|j|d|�r"d|fVdS)Nrr)rg)rrhrfr
r
r�generate_matches�szBasePattern.generate_matches)N)N)rBrCrDrr`rrrMrbrgrirjr
r
r
rr^�s


r^c@s*eZdZddd�Zd	dd�Zd
dd�ZdS)�LeafPatternNcCs&|dk	r|dk	r||_||_||_dS)N)rr`r)rrr`rr
r
rrL�s
zLeafPattern.__init__cCst|t�sdStj|||�S)NF)r r,r^rg)rr.rer
r
rrgs
zLeafPattern.matchcCs|j|jkS)N)r`r[)rr.rer
r
rrcs
zLeafPattern._submatch)NNN)N)N)rBrCrDrLrgrcr
r
r
rrk�s

rkc@s$eZdZdZddd�Zddd�ZdS)	�NodePatternFNcCsT|dk	r|dk	r>t|�}x$t|�D]\}}t|t�r"d|_q"W||_||_||_dS)NT)r!r1r �WildcardPattern�	wildcardsrr`r)rrr`rr2�itemr
r
rrL%s

zNodePattern.__init__cCs�|jrJx>t|j|j�D],\}}|t|j�kr|dk	r>|j|�dSqWdSt|j�t|j�krbdSx*t|j|j�D]\}}|j||�srdSqrWdS)NTF)rnrjr`r#r\rd�ziprg)rr.re�crf�
subpatternr5r
r
rrcBs

zNodePattern._submatch)NNN)N)rBrCrDrnrLrcr
r
r
rrl!s
rlc@sZeZdZddedfdd�Zdd�Zddd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)rmNrcCs@|dk	r$ttt|��}x|D]}qW||_||_||_||_dS)N)�tuplerOr`�min�maxr)rr`rtrur�altr
r
rrLls
zWildcardPattern.__init__cCs�d}|jdk	r<t|j�dkr<t|jd�dkr<|jdd}|jdkr�|jdkr�|jdkrft|jd�S|dk	r�|j|jkr�|j�S|jdkr�t|t�r�|jdkr�|j|jkr�t|j|j|j|j|j|j�S|S)Nrr)r)	r`r\rtrurlrrbr rm)rrrr
r
rrb�s 
 


zWildcardPattern.optimizecCs|j|g|�S)N)ri)rr.rer
r
rrg�szWildcardPattern.matchcCsRxL|j|�D]>\}}|t|�kr|dk	rF|j|�|jrFt|�||j<dSqWdS)NTF)rjr\rdrr!)rrhrerqrfr
r
rri�s
zWildcardPattern.match_seqccs:|jdkrXxJt|jdtt|�|j��D]*}i}|jrH|d|�||j<||fVq(Wn�|jdkrp|j|�Vn�ttd�r�tj	}t
�t_	z�y@x:|j|d�D]*\}}|jr�|d|�||j<||fVq�WWnRtk
�rx:|j
|�D],\}}|j�r
|d|�||j<||fVq�WYnXWdttd��r4|t_	XdS)NrZ	bare_name�getrefcountr)r`�rangertr\rur�_bare_name_matches�hasattrrG�stderrr�_recursive_matches�RuntimeError�_iterative_matches)rrh�countrfZsave_stderrr
r
rrj�s.
"

z WildcardPattern.generate_matchesccst|�}d|jkrdifVg}x>|jD]4}x.t||�D] \}}||fV|j||f�q8Wq(Wx�|�rg}x�|D]�\}}	||krr||jkrrxn|jD]d}x^t|||d��D]H\}
}|
dkr�i}|j|	�|j|�||
|fV|j||
|f�q�Wq�WqrW|}qbWdS)Nr)r\rtr`rjr%rurd)rrhZnodelenrervrqrfZnew_results�c0�r0�c1�r1r
r
rr~�s*




z"WildcardPattern._iterative_matchescCsxd}i}d}t|�}xH|r\||kr\d}x0|jD]&}|dj|||�r0|d7}d}Pq0WqW|d|�||j<||fS)NrFTr)r\r`rgr)rrhrrf�doneruZleafr
r
rry�s
z"WildcardPattern._bare_name_matchesc	cs�||jkrdifV||jkr�xr|jD]h}xbt||�D]T\}}xJ|j||d�|d�D].\}}i}|j|�|j|�|||fVqXWq6Wq&WdS)Nrr)rtrur`rjr|rd)	rrhrrvr�r�r�r�rfr
r
rr|s


"

z"WildcardPattern._recursive_matches)N)N)rBrCrD�HUGErLrbrgrirjr~ryr|r
r
r
rrm^s#

-rmc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�NegatedPatternNcCs|dk	r||_dS)N)r`)rr`r
r
rrLs	zNegatedPattern.__init__cCsdS)NFr
)rr.r
r
rrg)szNegatedPattern.matchcCst|�dkS)Nr)r\)rrhr
r
rri-szNegatedPattern.match_seqccsL|jdkr"t|�dkrHdifVn&x|jj|�D]
\}}dSWdifVdS)Nr)r`r\rj)rrhrqrfr
r
rrj1s
zNegatedPattern.generate_matches)N)rBrCrDrLrgrirjr
r
r
rr�s

r�c	cs�|sdifVn�|d|dd�}}xl|j|�D]^\}}|sJ||fVq2xDt|||d��D].\}}i}|j|�|j|�|||fVq^Wq2WdS)Nrr)rjrd)	Zpatternsrh�p�restr�r�r�r�rfr
r
rrj=s


rj)�
__author__rG�warnings�iorr�rrrrrIr,r]r^rkrlrmr�rjr
r
r
r�<module>
s$
1nNV,==#