AlkantarClanX12

Your IP : 18.226.248.88


Current Path : /lib64/python3.8/lib2to3/__pycache__/
Upload File :
Current File : //lib64/python3.8/lib2to3/__pycache__/pytree.cpython-38.opt-2.pyc

U

e5d8m�@s�dZddlZddlmZdZiadd�ZGdd�de�ZGd	d
�d
e�Z	Gdd�de�Z
d
d�ZGdd�de�ZGdd�de�Z
Gdd�de�ZGdd�de�ZGdd�de�Zdd�ZdS)z#Guido van Rossum <guido@python.org>�N)�StringIOi���cCsDts8ddlm}|j��D]\}}t|�tkr|t|<qt�||�S)N�)�python_symbols)�_type_reprsZpygramr�__dict__�items�type�int�
setdefault)Ztype_numr�name�val�r
�&/usr/lib64/python3.8/lib2to3/pytree.py�	type_reprs
rc@s�eZdZdZdZdZdZdZdd�Zdd�Z	dZ
dd	�Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�Zedd��Zedd��Zdd�Zdd�Zd d!�Zejd"kr�d#d$�ZdS)%�BaseNr
FcOs
t�|�S�N��object�__new__��cls�args�kwdsr
r
rr1szBase.__new__cCs|j|jk	rtS|�|�Sr)�	__class__�NotImplemented�_eq��self�otherr
r
r�__eq__6szBase.__eq__cCst�dSr��NotImplementedErrorrr
r
rrBs	zBase._eqcCst�dSrr �rr
r
r�cloneMsz
Base.clonecCst�dSrr r"r
r
r�
post_orderUszBase.post_ordercCst�dSrr r"r
r
r�	pre_order]szBase.pre_ordercCs~t|t�s|g}g}d}|jjD].}||krD|dk	r>|�|�d}q |�|�q |j��||j_|D]}|j|_qfd|_dS�NFT)�
isinstance�list�parent�children�extend�append�changed)r�newZ
l_children�found�ch�xr
r
r�replacees



zBase.replacecCs*|}t|t�s$|jsdS|jd}q|jS�Nr)r'�Leafr*�lineno�r�noder
r
r�
get_lineno|s
zBase.get_linenocCs|jr|j��d|_dS�NT)r)r-�was_changedr"r
r
rr-�s
zBase.changedcCsJ|jrFt|jj�D]2\}}||kr|j��|jj|=d|_|SqdSr)r)�	enumerater*r-)r�ir7r
r
r�remove�s

zBase.removec	Cs`|jdkrdSt|jj�D]@\}}||krz|jj|dWStk
rXYdSXqdS)Nr)r)r;r*�
IndexError�rr<�childr
r
r�next_sibling�s
zBase.next_siblingcCsR|jdkrdSt|jj�D]2\}}||kr|dkr8dS|jj|dSqdS�Nrr)r)r;r*r?r
r
r�prev_sibling�s
zBase.prev_siblingccs|jD]}|��EdHqdSr)r*�leaves�rr@r
r
rrD�s
zBase.leavescCs|jdkrdSd|j��SrB)r)�depthr"r
r
rrF�s
z
Base.depthcCs|j}|dkrdS|jS�N�)rA�prefix)rZnext_sibr
r
r�
get_suffix�szBase.get_suffix��rcCst|��d�S)N�ascii)�str�encoder"r
r
r�__str__�szBase.__str__)�__name__�
__module__�__qualname__rr)r*r:Zwas_checkedrr�__hash__rr#r$r%r2r8r-r=�propertyrArCrDrFrJ�sys�version_inforPr
r
r
rrs2
	




rc@s�eZdZddd�Zdd�Zdd�Zejdkr0eZd	d
�Z	dd�Z
d
d�Zdd�Ze
dd��Zejdd��Zdd�Zdd�Zdd�ZdS)�NodeNcCsN||_t|�|_|jD]
}||_q|dk	r0||_|rD|dd�|_nd|_dSr)rr(r*r)rI�fixers_applied)rrr*�contextrIrYr0r
r
r�__init__�s


z
Node.__init__cCsd|jjt|j�|jfS)Nz
%s(%s, %r))rrQrrr*r"r
r
r�__repr__�s�z
Node.__repr__cCsd�tt|j��SrG)�join�maprNr*r"r
r
r�__unicode__�szNode.__unicode__rKcCs|j|jf|j|jfkSr)rr*rr
r
rr�szNode._eqcCst|jdd�|jD�|jd�S)NcSsg|]}|���qSr
)r#)�.0r0r
r
r�
<listcomp>szNode.clone.<locals>.<listcomp>�rY)rXrr*rYr"r
r
rr#s�z
Node.cloneccs$|jD]}|��EdHq|VdSr)r*r$rEr
r
rr$s
zNode.post_orderccs$|V|jD]}|��EdHqdSr)r*r%rEr
r
rr%s
zNode.pre_ordercCs|js
dS|jdjS)NrHr�r*rIr"r
r
rrIszNode.prefixcCs|jr||jd_dSr3rc�rrIr
r
rrIscCs(||_d|j|_||j|<|��dSr)r)r*r-r?r
r
r�	set_child s
zNode.set_childcCs ||_|j�||�|��dSr)r)r*�insertr-r?r
r
r�insert_child*szNode.insert_childcCs||_|j�|�|��dSr)r)r*r,r-rEr
r
r�append_child3szNode.append_child)NNN)rQrRrSr[r\r_rVrWrPrr#r$r%rUrI�setterrergrhr
r
r
rrX�s&�




	rXc@s�eZdZdZdZdZddgfdd�Zdd�Zdd	�Ze	j
d
krBeZdd�Zd
d�Z
dd�Zdd�Zdd�Zedd��Zejdd��ZdS)r4rHrNcCsF|dk	r|\|_\|_|_||_||_|dk	r4||_|dd�|_dSr)�_prefixr5�columnr�valuerY)rrrlrZrIrYr
r
rr[Fsz
Leaf.__init__cCsd|jj|j|jfS)Nz
%s(%r, %r))rrQrrlr"r
r
rr\Ys�z
Leaf.__repr__cCs|jt|j�Sr)rIrNrlr"r
r
rr__szLeaf.__unicode__rKcCs|j|jf|j|jfkSr)rrlrr
r
rrjszLeaf._eqcCs$t|j|j|j|j|jff|jd�S)Nrb)r4rrlrIr5rkrYr"r
r
rr#ns
�z
Leaf.cloneccs
|VdSrr
r"r
r
rrDtszLeaf.leavesccs
|VdSrr
r"r
r
rr$wszLeaf.post_orderccs
|VdSrr
r"r
r
rr%{szLeaf.pre_ordercCs|jSr)rjr"r
r
rrIszLeaf.prefixcCs|��||_dSr)r-rjrdr
r
rrI�s)rQrRrSrjr5rkr[r\r_rVrWrPrr#rDr$r%rUrIrir
r
r
rr4=s(�


r4cCsN|\}}}}|s||jkr<t|�dkr.|dSt|||d�St|||d�SdS)Nrr)rZ)Z
number2symbol�lenrXr4)ZgrZraw_noderrlrZr*r
r
r�convert�srnc@sLeZdZdZdZdZdd�Zdd�Zdd�Zddd	�Z	dd
d�Z
dd
�ZdS)�BasePatternNcOs
t�|�Srrrr
r
rr�szBasePattern.__new__cCsHt|j�|j|jg}|r,|ddkr,|d=qd|jjd�tt|��fS)N���z%s(%s)z, )	rr�contentrrrQr]r^�repr)rrr
r
rr\�szBasePattern.__repr__cCs|Srr
r"r
r
r�optimize�szBasePattern.optimizecCsn|jdk	r|j|jkrdS|jdk	rRd}|dk	r4i}|�||�sDdS|rR|�|�|dk	rj|jrj|||j<dSr&)rrq�	_submatch�updater)rr7�results�rr
r
r�match�s


zBasePattern.matchcCs t|�dkrdS|�|d|�S)NrFr)rmrx)r�nodesrvr
r
r�	match_seq�szBasePattern.match_seqccs&i}|r"|�|d|�r"d|fVdSrB)rx)rryrwr
r
r�generate_matches�szBasePattern.generate_matches)N)N)rQrRrSrrqrrr\rsrxrzr{r
r
r
rro�s


roc@s*eZdZddd�Zd	dd�Zd
dd�ZdS)�LeafPatternNcCs&|dk	r|dk	r||_||_||_dSr)rrqr)rrrqrr
r
rr[�s
zLeafPattern.__init__cCst|t�sdSt�|||�S�NF)r'r4rorx�rr7rvr
r
rrx
s
zLeafPattern.matchcCs|j|jkSr)rqrlr~r
r
rrts
zLeafPattern._submatch)NNN)N)N)rQrRrSr[rxrtr
r
r
rr|�s

r|c@s$eZdZdZddd�Zddd�ZdS)	�NodePatternFNcCsP|dk	r|dk	r:t|�}t|�D]\}}t|t�r d|_q ||_||_||_dSr9)r(r;r'�WildcardPattern�	wildcardsrrqr)rrrqrr<�itemr
r
rr[$s
zNodePattern.__init__cCs�|jrHt|j|j�D].\}}|t|j�kr|dk	r<|�|�dSqdSt|j�t|j�kr`dSt|j|j�D]\}}|�||�sndSqndS�NTF)r�r{rqr*rmru�ziprx)rr7rv�crw�
subpatternr@r
r
rrtAs

zNodePattern._submatch)NNN)N)rQrRrSr�r[rtr
r
r
rr s
rc@sZeZdZddedfdd�Zdd�Zddd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)r�NrcCs<|dk	r ttt|��}|D]}q||_||_||_||_dSr)�tupler^rq�min�maxr)rrqr�r�r�altr
r
rr[kszWildcardPattern.__init__cCs�d}|jdk	r<t|j�dkr<t|jd�dkr<|jdd}|jdkr�|jdkr�|jdkrft|jd�S|dk	r�|j|jkr�|��S|jdkr�t|t�r�|jdkr�|j|jkr�t|j|j|j|j|j|j�S|S)Nrr)r)	rqrmr�r�rrrsr'r�)rr�r
r
rrs�s.
��
�
�

�zWildcardPattern.optimizecCs|�|g|�Sr)rzr~r
r
rrx�szWildcardPattern.matchcCsP|�|�D]@\}}|t|�kr
|dk	rD|�|�|jrDt|�||j<dSq
dSr�)r{rmrurr()rryrvr�rwr
r
rrz�s
zWildcardPattern.match_seqc	cs,|jdkrTt|jdtt|�|j��D]*}i}|jrF|d|�||j<||fVq&n�|jdkrl|�|�Vn�ttd�r�tj	}t
�t_	z�z<|�|d�D]*\}}|jr�|d|�||j<||fVq�WnLtk
�r|�
|�D]*\}}|jr�|d|�||j<||fVq�YnXW5ttd��r&|t_	XdS)NrZ	bare_name�getrefcountr)rq�ranger�rmr�r�_bare_name_matches�hasattrrV�stderrr�_recursive_matches�RuntimeError�_iterative_matches)rry�countrwZsave_stderrr
r
rr{�s.
 

z WildcardPattern.generate_matchesccs�t|�}d|jkrdifVg}|jD]0}t||�D] \}}||fV|�||f�q4q&|r�g}|D]�\}}	||krd||jkrd|jD]`}t|||d��D]H\}
}|
dkr�i}|�|	�|�|�||
|fV|�||
|f�q�q�qd|}qXdSr3)rmr�rqr{r,r�ru)rryZnodelenrvr�r�rwZnew_results�c0�r0�c1�r1r
r
rr��s*






z"WildcardPattern._iterative_matchescCspd}i}d}t|�}|sV||krVd}|jD](}|d�|||�r*|d7}d}qq*q|d|�||j<||fS)NrFTr)rmrqrxr)rryr�rwZdoner�Zleafr
r
rr��s
z"WildcardPattern._bare_name_matchesc	cs�||jkrdifV||jkr�|jD]`}t||�D]P\}}|�||d�|d�D].\}}i}|�|�|�|�|||fVqRq2q$dSrB)r�r�rqr{r�ru)	rryr�r�r�r�r�r�rwr
r
rr�
s



 

z"WildcardPattern._recursive_matches)N)N)rQrRrS�HUGEr[rsrxrzr{r�r�r�r
r
r
rr�]s#

-r�c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�NegatedPatternNcCs|dk	r||_dSr)rq)rrqr
r
rr[s	zNegatedPattern.__init__cCsdSr}r
r6r
r
rrx(szNegatedPattern.matchcCst|�dkSr3)rm)rryr
r
rrz,szNegatedPattern.match_seqccsJ|jdkr"t|�dkrFdifVn$|j�|�D]\}}dSdifVdSr3)rqrmr{)rryr�rwr
r
rr{0s
zNegatedPattern.generate_matches)N)rQrRrSr[rxrzr{r
r
r
rr�s

r�c	cs�|sdifVn||d|dd�}}|�|�D]Z\}}|sH||fVq0t|||d��D].\}}i}|�|�|�|�|||fVqZq0dSrB)r{ru)	Zpatternsry�p�restr�r�r�r�rwr
r
rr{<s


r{)�
__author__rV�iorr�rrrrrXr4rnror|rr�r�r{r
r
r
r�<module>
s"
1nNV,==#