Your IP : 18.191.218.234


Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/__pycache__/pytree.cpython-310.opt-2.pyc

o

6��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���cCsDtsddlm}|j��D]\}}t|�tkr|t|<q
t�||�S)N�)�python_symbols)�_type_reprsZpygramr�__dict__�items�type�int�
setdefault)Ztype_numr�name�val�r
�5/opt/alt/python310/lib64/python3.10/lib2to3/pytree.py�	type_reprs�rc@s�eZdZ	dZdZdZdZdZdd�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$�ZdSdS)%�BaseNr
FcO�	t�|�S�N��object�__new__��cls�args�kwdsr
r
rr1�
zBase.__new__cCs	|j|jur	tS|�|�Sr)�	__class__�NotImplemented�_eq��self�otherr
r
r�__eq__6s
zBase.__eq__cC�	t�r��NotImplementedErrorrr
r
rrBszBase._eqcCr"rr#�rr
r
r�cloneM�z
Base.clonecCr"rr#r%r
r
r�
post_orderUr'zBase.post_ordercCr"rr#r%r
r
r�	pre_order]r'zBase.pre_ordercCs�	t|t�s	|g}g}d}|jjD]}||ur#|dur |�|�d}q|�|�q|j��||j_|D]}|j|_q4d|_dS�NFT)�
isinstance�list�parent�children�extend�append�changed)r�newZ
l_children�found�ch�xr
r
r�replacees 




zBase.replacecCs4	|}t|t�s|js
dS|jd}t|t�r|jS�Nr)r+�Leafr.�lineno�r�noder
r
r�
get_lineno|s


�zBase.get_linenocCs|jr|j��d|_dS�NT)r-r1�was_changedr%r
r
rr1�s

zBase.changedcCsP	|jr$t|jj�D]\}}||ur#|j��|jj|=d|_|Sq
dSdSr)r-�	enumerater.r1)r�ir;r
r
r�remove�s

��zBase.removec	Cs`	|jdurdSt|jj�D]\}}||ur-z|jj|dWSty,YdSwqdS)Nr)r-r?r.�
IndexError�rr@�childr
r
r�next_sibling�s
���zBase.next_siblingcCsT	|jdurdSt|jj�D]\}}||ur'|dkrdS|jj|dSqdS�Nrr)r-r?r.rCr
r
r�prev_sibling�s
��zBase.prev_siblingccs �|jD]	}|��EdHqdSr)r.�leaves�rrDr
r
rrH�s�
�zBase.leavescCs|jdurdSd|j��SrF)r-�depthr%r
r
rrJ�s
z
Base.depthcCs	|j}|dur
dS|jS�N�)rE�prefix)rZnext_sibr
r
r�
get_suffix�s
zBase.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)r6r<r1rA�propertyrErGrHrJrN�sys�version_inforTr
r
r
rrs8

	



�rc@s�eZdZ				ddd�Zdd�Zdd�ZejdkreZd	d
�Z	dd�Z
d
d�Zdd�Ze
dd��Zejdd��Zdd�Zdd�Zdd�ZdS)�NodeNcCsR	||_t|�|_|jD]}||_q|dur||_|r$|dd�|_dSd|_dSr)rr,r.r-rM�fixers_applied)rrr.�contextrMr]r4r
r
r�__init__�s	


z
Node.__init__cCs	d|jjt|j�|jfS)Nz
%s(%s, %r))rrUrrr.r%r
r
r�__repr__�s
�z
Node.__repr__cCs	d�tt|j��SrK)�join�maprRr.r%r
r
r�__unicode__�szNode.__unicode__rOcC�	|j|jf|j|jfkSr)rr.rr
r
rr��zNode._eqcCs 	t|jdd�|jD�|jd�S)NcSsg|]}|���qSr
)r&)�.0r4r
r
r�
<listcomp>szNode.clone.<locals>.<listcomp>�r])r\rr.r]r%r
r
rr&s�z
Node.cloneccs(�	|jD]	}|��EdHq|VdSr)r.r(rIr
r
rr(s
�

zNode.post_orderccs(�	|V|jD]	}|��EdHqdSr)r.r)rIr
r
rr)s�
�zNode.pre_ordercCs	|jsdS|jdjS)NrLr�r.rMr%r
r
rrMszNode.prefixcCs|jr||jd_dSdSr7ri�rrMr
r
rrMs�cCs*	||_d|j|_||j|<|��dSr)r-r.r1rCr
r
r�	set_child s

zNode.set_childcCs"	||_|j�||�|��dSr)r-r.�insertr1rCr
r
r�insert_child*szNode.insert_childcCs 	||_|j�|�|��dSr)r-r.r0r1rIr
r
r�append_child3szNode.append_child�NNN)rUrVrWr_r`rcrZr[rTrr&r(r)rYrM�setterrkrmrnr
r
r
rr\�s*
�



	r\c@s�eZdZ	dZdZdZddgfdd�Zdd�Zdd	�Ze	j
d
kr"eZdd�Zd
d�Z
dd�Zdd�Zdd�Zedd��Zejdd��ZdS)r8rLrNcCsH	|dur|\|_\|_|_||_||_|dur||_|dd�|_dSr)�_prefixr9�columnr�valuer])rrrsr^rMr]r
r
rr_Fsz
Leaf.__init__cCs	d|jj|j|jfS)Nz
%s(%r, %r))rrUrrsr%r
r
rr`Ys
�z
Leaf.__repr__cCs	|jt|j�Sr)rMrRrsr%r
r
rrc_szLeaf.__unicode__rOcCrdr)rrsrr
r
rrjrezLeaf._eqcCs&	t|j|j|j|j|jff|jd�S)Nrh)r8rrsrMr9rrr]r%r
r
rr&ns

�z
Leaf.cloneccs�|VdSrr
r%r
r
rrHts�
zLeaf.leavescc��	|VdSrr
r%r
r
rr(w��
zLeaf.post_orderccrtrr
r%r
r
rr){ruzLeaf.pre_ordercCs	|jSr)rqr%r
r
rrMszLeaf.prefixcCs|��||_dSr)r1rqrjr
r
rrM�s
)rUrVrWrqr9rrr_r`rcrZr[rTrr&rHr(r)rYrMrpr
r
r
rr8=s,
�

r8cCsL	|\}}}}|s||jvrt|�dkr|dSt|||d�St|||d�S)Nrr)r^)Z
number2symbol�lenr\r8)ZgrZraw_noderrsr^r.r
r
r�convert�srwc@sNeZdZ	dZdZdZdd�Zdd�Zdd�Zddd	�Z	dd
d�Z
dd
�ZdS)�BasePatternNcOrrrrr
r
rr�rzBasePattern.__new__cCsVt|j�|j|jg}|r|ddur|d=|r|ddusd|jjd�tt|��fS)N���z%s(%s)z, )	rr�contentrrrUrarb�repr)rrr
r
rr`�s
�zBasePattern.__repr__cCs	|Srr
r%r
r
r�optimize�r'zBasePattern.optimizecCsp	|jdur|j|jkrdS|jdur*d}|duri}|�||�s#dS|r*|�|�|dur6|jr6|||j<dSr*)rrz�	_submatch�updater)rr;�results�rr
r
r�match�s



zBasePattern.matchcCs"	t|�dkr	dS|�|d|�S)NrFr)rvr�)r�nodesrr
r
r�	match_seq�szBasePattern.match_seqccs2�	i}|r|�|d|�rd|fVdSdSdSrF)r�)rr�r�r
r
r�generate_matches�s��zBasePattern.generate_matchesr)rUrVrWrrzrrr`r|r�r�r�r
r
r
rrx�s


rxc@s*eZdZddd�Zd	dd�Zd	dd�ZdS)
�LeafPatternNcCs(	|dur|dur	||_||_||_dSr)rrzr)rrrzrr
r
rr_�s
zLeafPattern.__init__cCs	t|t�sdSt�|||�S�NF)r+r8rxr��rr;rr
r
rr�
s
zLeafPattern.matchcCs	|j|jkSr)rzrsr�r
r
rr}szLeafPattern._submatchror)rUrVrWr_r�r}r
r
r
rr��s

r�c@s$eZdZdZddd�Zddd�ZdS)	�NodePatternFNcCsR	|dur|durt|�}t|�D]\}}t|t�rd|_q||_||_||_dSr=)r,r?r+�WildcardPattern�	wildcardsrrzr)rrrzrr@�itemr
r
rr_$s
�
zNodePattern.__init__cCs�	|jr%t|j|j�D]\}}|t|j�kr"|dur|�|�dSqdSt|j�t|j�kr1dSt|j|j�D]
\}}|�||�sEdSq8dS�NTF)r�r�rzr.rvr~�zipr�)rr;r�cr��
subpatternrDr
r
rr}As 
��zNodePattern._submatchror)rUrVrWr�r_r}r
r
r
rr� s
r�c@s\eZdZ	ddedfdd�Zdd�Zddd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)r�NrcCs>	|durttt|��}|D]}q||_||_||_||_dSr)�tuplerbrz�min�maxr)rrzr�r�r�altr
r
rr_ks

zWildcardPattern.__init__cCs�	d}|jdurt|j�dkrt|jd�dkr|jdd}|jdkrB|jdkrB|jdur4t|jd�S|durB|j|jkrB|��S|jdkrht|t�rh|jdkrh|j|jkrht|j|j|j|j|j|j�S|S)Nrr)r)	rzrvr�r�r�rr|r+r�)rr�r
r
rr|�s$
 


�zWildcardPattern.optimizecCs	|�|g|�Sr)r�r�r
r
rr��szWildcardPattern.matchcCsR	|�|�D] \}}|t|�kr&|dur#|�|�|jr#t|�||j<dSqdSr�)r�rvr~rr,)rr�rr�r�r
r
rr��s
�zWildcardPattern.match_seqc	cs@�	|jdur-t|jdtt|�|j��D]}i}|jr%|d|�||j<||fVqdS|jdkr:|�|�VdSttd�rFtj	}t
�t_	zPz|�|d�D]\}}|jr^|d|�||j<||fVqNWn$ty�|�
|�D]\}}|jr�|d|�||j<||fVqqYnwWttd�r�|t_	dSdSttd�r�|t_	w)NrZ	bare_name�getrefcountr)rz�ranger�rvr�r�_bare_name_matches�hasattrrZ�stderrr�_recursive_matches�RuntimeError�_iterative_matches)rr��countr�Zsave_stderrr
r
rr��s@�
 �

����

�z WildcardPattern.generate_matchesccs��	t|�}d|jkrdifVg}|jD]}t||�D]\}}||fV|�||f�qq|r|g}|D]A\}}	||kru||jkru|jD]0}t|||d��D]$\}
}|
dkrsi}|�|	�|�|�||
|fV|�||
|f�qOqDq4|}|s0dSdSr7)rvr�rzr�r0r�r~)rr�Znodelenrr�r�r�Znew_results�c0�r0�c1�r1r
r
rr��s8�



�


����z"WildcardPattern._iterative_matchescCs|	d}i}d}t|�}|s1||kr1d}|jD]}|d�|||�r*|d7}d}nq|s1||ks|d|�||j<||fS)NrFTr)rvrzr�r)rr�r�r�Zdoner�Zleafr
r
rr��s 
��z"WildcardPattern._bare_name_matchesc	cs��	||jkrdifV||jkrE|jD]2}t||�D](\}}|�||d�|d�D]\}}i}|�|�|�|�|||fVq+qqdSdSrF)r�r�rzr�r�r~)	rr�r�r�r�r�r�r�r�r
r
rr�
s �



 

���z"WildcardPattern._recursive_matchesr)rUrVrW�HUGEr_r|r�r�r�r�r�r�r
r
r
rr�]s#

-r�c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�NegatedPatternNcCs	|dur||_dSr)rz)rrzr
r
rr_s
zNegatedPattern.__init__cCsdSr�r
r:r
r
rr�(szNegatedPattern.matchcCst|�dkSr7)rv)rr�r
r
rr�,szNegatedPattern.match_seqccsR�|jdurt|�dkrdifVdSdS|j�|�D]\}}dSdifVdSr7)rzrvr�)rr�r�r�r
r
rr�0s�
�zNegatedPattern.generate_matchesr)rUrVrWr_r�r�r�r
r
r
rr�s


r�c	cs��	|sdifVdS|d|dd�}}|�|�D]-\}}|s'||fVqt|||d��D]\}}i}|�|�|�|�|||fVq0qdSrF)r�r~)	�patternsr��p�restr�r�r�r�r�r
r
rr�<s�

��r�)�
__author__rZ�iorr�rrrrr\r8rwrxr�r�r�r�r�r
r
r
r�<module>s&	
1nNV,==#

?>