Your IP : 18.118.164.100


Current Path : /opt/alt/python39/lib64/python3.9/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/lib2to3/__pycache__/pytree.cpython-39.opt-2.pyc

a

R�fFm�@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
�3/opt/alt/python39/lib64/python3.9/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|jurtS|�|�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].}||urD|dur>|�|�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\}}||ur|j��|jj|=d|_|SqdSr)r)�	enumerater*r-)r�ir7r
r
r�remove�s

zBase.removec	Cs^|jdurdSt|jj�D]>\}}||urz|jj|dWStyVYdS0qdS)Nr)r)r;r*�
IndexError�rr<�childr
r
r�next_sibling�s
zBase.next_siblingcCsR|jdurdSt|jj�D]2\}}||ur|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|jdurdSd|j��SrB)r)�depthr"r
r
rrF�s
z
Base.depthcCs|j}|durdS|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|dur0||_|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>�zNode.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_dSr3rd�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�setterrfrhrir
r
r
rrX�s&�




	rXc@s�eZdZdZdZdZddgfdd�Zdd�Zdd	�Ze	j
d
krBeZdd�Zd
d�Z
dd�Zdd�Zdd�Zedd��Zejdd��ZdS)r4rHrNcCsF|dur|\|_\|_|_||_||_|dur4||_|dd�|_dSr)�_prefixr5�columnr�valuerY)rrrmrZrIrYr
r
rr[Fsz
Leaf.__init__cCsd|jj|j|jfS)Nz
%s(%r, %r))rrQrrmr"r
r
rr\Ys�z
Leaf.__repr__cCs|jt|j�Sr)rIrNrmr"r
r
rr__szLeaf.__unicode__rKcCs|j|jf|j|jfkSr)rrmrr
r
rrjszLeaf._eqcCs$t|j|j|j|j|jff|jd�S)Nrc)r4rrmrIr5rlrYr"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)rkr"r
r
rrIszLeaf.prefixcCs|��||_dSr)r-rkrer
r
rrI�s)rQrRrSrkr5rlr[r\r_rVrWrPrr#rDr$r%rUrIrjr
r
r
rr4=s(�


r4cCsN|\}}}}|s||jvr<t|�dkr.|dSt|||d�St|||d�SdS)Nrr)rZ)Z
number2symbol�lenrXr4)ZgrZraw_noderrmrZr*r
r
r�convert�sroc@sLeZdZdZdZdZdd�Zdd�Zdd�Zddd	�Z	dd
d�Z
dd
�ZdS)�BasePatternNcOs
t�|�Srrrr
r
rr�szBasePattern.__new__cCsHt|j�|j|jg}|r,|ddur,|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|jdur|j|jkrdS|jdurRd}|dur4i}|�||�sDdS|rR|�|�|durj|jrj|||j<dSr&)rrr�	_submatch�updater)rr7�results�rr
r
r�match�s


zBasePattern.matchcCs t|�dkrdS|�|d|�S)NrFr)rnry)r�nodesrwr
r
r�	match_seq�szBasePattern.match_seqccs&i}|r"|�|d|�r"d|fVdSrB)ry)rrzrxr
r
r�generate_matches�szBasePattern.generate_matches)N)N)rQrRrSrrrrrr\rtryr{r|r
r
r
rrp�s


rpc@s*eZdZddd�Zd	dd�Zd
dd�ZdS)�LeafPatternNcCs&|dur|dur||_||_||_dSr)rrrr)rrrrrr
r
rr[�s
zLeafPattern.__init__cCst|t�sdSt�|||�S�NF)r'r4rpry�rr7rwr
r
rry
s
zLeafPattern.matchcCs|j|jkSr)rrrmrr
r
rrus
zLeafPattern._submatch)NNN)N)N)rQrRrSr[ryrur
r
r
rr}�s

r}c@s$eZdZdZddd�Zddd�ZdS)	�NodePatternFNcCsP|dur|dur:t|�}t|�D]\}}t|t�r d|_q ||_||_||_dSr9)r(r;r'�WildcardPattern�	wildcardsrrrr)rrrrrr<�itemr
r
rr[$s
zNodePattern.__init__cCs�|jrHt|j|j�D].\}}|t|j�kr|dur<|�|�dSqdSt|j�t|j�kr`dSt|j|j�D]\}}|�||�sndSqndS�NTF)r�r|rrr*rnrv�zipry)rr7rw�crx�
subpatternr@r
r
rruAs

zNodePattern._submatch)NNN)N)rQrRrSr�r[rur
r
r
rr� s
r�c@sZeZdZddedfdd�Zdd�Zddd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)r�NrcCs<|dur ttt|��}|D]}q||_||_||_||_dSr)�tupler^rr�min�maxr)rrrr�r�r�altr
r
rr[kszWildcardPattern.__init__cCs�d}|jdur<t|j�dkr<t|jd�dkr<|jdd}|jdkr�|jdkr�|jdurft|jd�S|dur�|j|jkr�|��S|jdkr�t|t�r�|jdkr�|j|jkr�t|j|j|j|j|j|j�S|S)Nrr)r)	rrrnr�r�r�rrtr'r�)rr�r
r
rrt�s.
��
�
�

�zWildcardPattern.optimizecCs|�|g|�Sr)r{rr
r
rry�szWildcardPattern.matchcCsP|�|�D]@\}}|t|�kr
|durD|�|�|jrDt|�||j<dSq
dSr�)r|rnrvrr()rrzrwr�rxr
r
rr{�s
zWildcardPattern.match_seqc	cs<|jdurTt|jdtt|�|j��D]*}i}|jrF|d|�||j<||fVq&n�|jdkrl|�|�Vn�ttd�r�tj	}t
�t_	z�z<|�|d�D]*\}}|jr�|d|�||j<||fVq�WnJt�y|�
|�D]*\}}|jr�|d|�||j<||fVq�Yn0Wttd��r8|t_	nttd��r6|t_	0dS)NrZ	bare_name�getrefcountr)rr�ranger�rnr�r�_bare_name_matches�hasattrrV�stderrr�_recursive_matches�RuntimeError�_iterative_matches)rrz�countrxZsave_stderrr
r
rr|�s2
 

�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)rnr�rrr|r,r�rv)rrzZnodelenrwr�r�rxZnew_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)rnrrryr)rrzr�rxZdoner�Zleafr
r
rr��s
z"WildcardPattern._bare_name_matchesc	cs�||jkrdifV||jkr�|jD]`}t||�D]P\}}|�||d�|d�D].\}}i}|�|�|�|�|||fVqRq2q$dSrB)r�r�rrr|r�rv)	rrzr�r�r�r�r�r�rxr
r
rr�
s



 

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

-r�c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�NegatedPatternNcCs|dur||_dSr)rr)rrrr
r
rr[s	zNegatedPattern.__init__cCsdSr~r
r6r
r
rry(szNegatedPattern.matchcCst|�dkSr3)rn)rrzr
r
rr{,szNegatedPattern.match_seqccsJ|jdur"t|�dkrFdifVn$|j�|�D]\}}dSdifVdSr3)rrrnr|)rrzr�rxr
r
rr|0s
zNegatedPattern.generate_matches)N)rQrRrSr[ryr{r|r
r
r
rr�s

r�c	cs�|sdifVn||d|dd�}}|�|�D]Z\}}|sH||fVq0t|||d��D].\}}i}|�|�|�|�|||fVqZq0dSrB)r|rv)	Zpatternsrz�p�restr�r�r�r�rxr
r
rr|<s


r|)�
__author__rV�iorr�rrrrrXr4rorpr}r�r�r�r|r
r
r
r�<module>
s"
1nNV,==#

?>