Hacked By AnonymousFox

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

o

6��f��@sj	dZddlZddlZddlmZddlmZddlmZGdd�de	�Z
Gd	d
�d
e	�Ziadd�Z
dS)
z+George Boutsioukis <gboutsioukis@gmail.com>�N)�defaultdict�)�pytree)�reduce_treec@seZdZ	e��Zdd�ZdS)�BMNodecCs"i|_g|_ttj�|_d|_dS)N�)�transition_table�fixers�nextr�count�id�content��self�r�:/opt/alt/python310/lib64/python3.10/lib2to3/btm_matcher.py�__init__s
zBMNode.__init__N)�__name__�
__module__�__qualname__�	itertoolsrrrrrrrsrc@s6eZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
BottomMatchercCs0t�|_t�|_|jg|_g|_t�d�|_dS)NZRefactoringTool)	�set�matchr�rootZnodesr	�loggingZ	getLoggerZloggerrrrrrs

zBottomMatcher.__init__cCsJ	|j�|�t|j�}|��}|j||jd�}|D]}|j�|�qdS)N��start)r	�appendrZpattern_treeZget_linear_subpattern�addr)r�fixerZtreeZlinear�match_nodesZ
match_noderrr�	add_fixer%s
�zBottomMatcher.add_fixerc	Cs�	|s|gSt|dt�r1g}|dD]}|j||d�}|D]}|�|�|dd�|��qq|S|d|jvrCt�}||j|d<n|j|d}|dd�r]|j|dd�|d�}|S|g}|S)Nrrr)�
isinstance�tupler�extendrr)r�patternrr!ZalternativeZ	end_nodes�endZ	next_noderrrr1s(��zBottomMatcher.addc	Cs�	|j}tt�}|D]l}|}|rvd|_|jD]}t|tj�r(|jdkr(d|_nq|j	dkr2|j}n|j	}||j
vrM|j
|}|jD]	}||�|�qBn$|j}|j
durZ|j
jrZn||j
vrq|j
|}|jD]	}||�|�qg|j
}|sq
|S)NT�;Fr)rr�listZwas_checked�childrenr#rZLeaf�value�typerr	r�parent)	rZleavesZcurrent_ac_nodeZresultsZleafZcurrent_ast_node�childZ
node_tokenr rrr�runSsB
�



�
�


��"zBottomMatcher.runcs,	td��fdd���|j�td�dS)Nz
digraph g{csZ|j��D]%}|j|}td|j|jt|�t|j�f�|dkr&t|j��|�qdS)Nz%d -> %d [label=%s] //%sr)r�keys�printr�	type_repr�strr	r
)ZnodeZsubnode_keyZsubnode��
print_noderrr5�s
�

�z*BottomMatcher.print_ac.<locals>.print_node�})r1rrrr4r�print_ac�s

zBottomMatcher.print_acN)rrrrr"rr/r7rrrrrs"8rcCsDtsddlm}|j��D]\}}t|�tkr|t|<q
t�||�S)Nr)�python_symbols)�_type_reprsZpygramr8�__dict__�itemsr,�int�
setdefault)Ztype_numr8�name�valrrrr2�s�r2)�
__author__rr�collectionsrrrZ	btm_utilsr�objectrrr9r2rrrr�<module>s	

Hacked By AnonymousFox1.0, Coded By AnonymousFox