Your IP : 3.138.137.244


Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/btm_matcher.cpython-312.opt-2.pyc

�

�Q�f���t�	dZddlZddlZddlmZddlmZddlmZGd�de	�Z
Gd	�d
e	�Ziad�Z
y)z+George Boutsioukis <gboutsioukis@gmail.com>�N)�defaultdict�)�pytree)�reduce_treec�6�eZdZ	ej�Zd�Zy)�BMNodec�j�i|_g|_ttj�|_d|_y)N�)�transition_table�fixers�nextr�count�id�content��selfs �:/opt/alt/python312/lib64/python3.12/lib2to3/btm_matcher.py�__init__zBMNode.__init__s(�� "�������v�|�|�$������N)�__name__�
__module__�__qualname__�	itertoolsrr�rrrrs��I��I�O�O��E�rrc�,�eZdZ	d�Zd�Zd�Zd�Zd�Zy)�
BottomMatcherc��t�|_t�|_|jg|_g|_t
jd�|_y)N�RefactoringTool)	�set�matchr�root�nodesr�logging�	getLogger�loggerrs rrzBottomMatcher.__init__s;���U��
��H��	��i�i�[��
�����'�'�(9�:��rc��	|jj|�t|j�}|j	�}|j||j��}|D]}|jj|��y)N��start)r�appendr�pattern_tree�get_linear_subpattern�addr!)r�fixer�tree�linear�match_nodes�
match_nodes      r�	add_fixerzBottomMatcher.add_fixer%sm��	�	
�����5�!��5�-�-�.���+�+�-���h�h�v�T�Y�Y�h�7��%�J����$�$�U�+�&rc	��	|s|gSt|dt�rLg}|dD]@}|j||��}|D]&}|j|j|dd|���(�B|S|d|jvrt�}||j|d<n|j|d}|ddr|j|dd|��}|S|g}|S)Nrr'r)�
isinstance�tupler,�extendrr)r�patternr(r0�alternative�	end_nodes�end�	next_nodes        rr,zBottomMatcher.add1s���?���7�N��g�a�j�%�(��K�&�q�z��!�H�H�[��H�>�	�$�C��&�&�t�x�x�����S�'A�B�%�	 *����q�z��!7�!7�7�"�H�	�5>��&�&�w�q�z�2�"�2�2�7�1�:�>�	��q�r�{� �H�H�W�Q�R�[�	�H�B�	���'�K�	��rc���	|j}tt�}|D�]?}|}|s�	d|_|jD]5}t|tj�s�|jdk(s�.d|_n|jdk(r
|j}n|j}||jvr5|j|}|jD]}||j|��nq|j}|j�|jjr��||jvr4|j|}|jD]}||j|��|j}|r��7��B|S)NT�;Fr)r!r�list�was_checked�childrenr4r�Leaf�value�typerrr)�parent)	r�leaves�current_ac_node�results�leaf�current_ast_node�child�
node_tokenr-s	         r�runzBottomMatcher.runSs\��	��)�)���d�#���D�#��"�/3� �,�-�6�6�E�!�%����5�%�+�+��:L�7<�(�4��	7�
$�(�(�A�-�!1�!7�!7�J�!1�!6�!6�J���!A�!A�A�&5�&F�&F�z�&R�O�!0�!7�!7�����-�-�.>�?�"8�'+�i�i�O�(�/�/�;�,�3�3�?�?��"�_�%E�%E�E�*9�*J�*J�:�*V��%4�%;�%;�E�#�E�N�1�1�2B�C�&<�$4�#:�#:� �C#��H�rc�b��	td��fd���|j�td�y)Nz
digraph g{c
�*��|jj�D]u}|j|}td|j|jt	|�t|j�fz�|dk(rt|j��|��wy)Nz%d -> %d [label=%s] //%sr)r�keys�printr�	type_repr�strrr)�node�subnode_key�subnode�
print_nodes   �rrVz*BottomMatcher.print_ac.<locals>.print_node�s|���#�4�4�9�9�;���/�/��<���0��w�w��
�
�I�k�,B�C����DW�X�Y�Z��!�#��'�/�/�*��7�#�
 <r�})rPr!)rrVs @r�print_aczBottomMatcher.print_ac�s(���F�
�l��	$�	�4�9�9��
�c�
rN)rrrrr2r,rLrXrrrrrs"��+�;�
,� �D6�prrc���tsDddlm}|jj	�D]!\}}t|�tk(s�|t|<�#tj||�S)Nr)�python_symbols)�_type_reprs�pygramrZ�__dict__�itemsrC�int�
setdefault)�type_numrZ�name�vals    rrQrQ�sO���*�(�0�0�6�6�8�I�D�#��C�y�C��D��S�!1�9��!�!�(�H�5�5r)�
__author__r#r�collectionsrr
r�	btm_utilsr�objectrrr[rQrrr�<module>rhsH��G�;�
���#��"��V��}�F�}�@��6r

?>