Your IP : 3.144.237.52


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

�

�Q�f�&���	ddlmZddlmZmZddlmZmZeZeZ	ejZeZdZ
dZdZGd�de�Zd
d
�Zd�Zd�Zy	)�)�pytree)�grammar�token)�pattern_symbols�python_symbols���������c�.�eZdZ	dd�Zd�Zd�Zd�Zd�Zy)�MinNodeNc�f�||_||_g|_d|_d|_g|_g|_y)NF)�type�name�children�leaf�parent�alternatives�group)�selfrrs   �8/opt/alt/python312/lib64/python3.12/lib2to3/btm_utils.py�__init__zMinNode.__init__s4����	���	���
���	���������
�c�^�t|j�dzt|j�zS)N� )�strrr)rs r�__repr__zMinNode.__repr__s"���4�9�9�~��#�c�$�)�)�n�4�4rc�F�	|}g}|�r�|jtk(r�|jj|�t	|j�t	|j
�k(r*t
|j�g}g|_|j}��|j}d}	|S|jtk(r�|jj|�t	|j�t	|j
�k(r*t|j�}g|_	|j}��|j}d}	|S|jtjk(r(|jr|j|j�n|j|j�|j}|r���|S�N)r�TYPE_ALTERNATIVESr�append�lenr�tupler�
TYPE_GROUPr�get_characteristic_subpattern�token_labels�NAMEr)r�node�subps   r�leaf_to_rootzMinNode.leaf_to_root!sU��	7�������y�y�-�-��!�!�(�(��.��t�(�(�)�S����-?�?�!�$�"3�"3�4�5�D�(*�D�%��;�;�D���;�;�D��D��,��)�y�y�J�&��
�
�!�!�$�'��t�z�z�?�c�$�-�-�&8�8�8����D�D�!#�D�J��;�;�D���;�;�D��D�����y�y�L�-�-�-�$�)�)����D�I�I�&����D�I�I�&��;�;�D�C�D�rc�\�	|j�D]}|j�}|s�|cSyr)�leavesr))r�lr(s   r�get_linear_subpatternzMinNode.get_linear_subpatternKs-��
	�����A��>�>�#�D����rc#�K�	|jD]}|j�Ed{����|js|��yy7��wr)rr+)r�childs  rr+zMinNode.leaves`s<����7��]�]�E��|�|�~�%�%�#��}�}��J��
&�s�$A�?�A)NN)�__name__�
__module__�__qualname__rrr)r-r+�rrrrs!����5�(�T�*rrNc�
�	d}|jtjk(r|jd}|jtjk(r�t|j�dkrt
|jd|�}�n�tt��}|jD]K}|jj|�dzr�"t
||�}|��1|jj|��M�na|jtjk(r�t|j�dkDr\tt��}|jD],}t
||�}|s�|jj|��.|j�s�d}�n�t
|jd|�}�n�|jtjk(�r�t|jdtj �r5|jdj"dk(rt
|jd|�St|jdtj �r|jdj"dk(sMt|j�dkDr6t%|jdd�r|jdj"dk(ryd}d}d}d	}d}	d	}
|jD]�}|jtj&k(rd	}|}nA|jtj(k(rd}|}	n|jtjk(r|}t%|d�s�s|j"d
k(s��d}
��|
r:|jd}t%|d�r.|j"dk(r|jd}n|jd}|jt*j,k(r�|j"dk(rtt.��}n�t%t*|j"�r%tt1t*|j"���}n�tt1t2|j"���}n�|jt*j4k(rS|j"j7d
�}|t8vrtt8|��}nEtt*j,|��}n)|jtjk(rt
||�}|rB|	jdj"dk(rd}n#|	jdj"dk(rnt:�|r@|�>|jddD],}t
||�}|��|jj|��.|r||_|S)N��)rr�(�[�valueTF�=��any�')rr�*�+r)r�syms�Matcherr�Alternativesr!�reduce_treerr�indexr �Alternativer#�Unit�
isinstancer�Leafr9�hasattr�Details�Repeaterr%r&�TYPE_ANY�getattr�pysyms�STRING�strip�tokens�NotImplementedErrorr)
r'r�new_noder/�reducedr�details_node�alternatives_node�has_repeater�
repeater_node�has_variable_name�	name_leafrs
             rrCrCgsN����H��y�y�D�L�L� ��}�}�Q����y�y�D�%�%�%��t�}�}���"�"�4�=�=��#3�V�<�H��$5�6�H������=�=�&�&�u�-�a�/��%�e�X�6���&��%�%�,�,�W�5�'�
���d�&�&�	&��t�}�}���!��J�/�H�����%�e�X�6����%�%�,�,�W�5�'��$�$���#�4�=�=��#3�V�<�H�	
���d�i�i�	��t�}�}�Q�'����5��M�M�!��"�"�c�)��t�}�}�Q�/��8�8�
��
�
�a�(�&�+�+�
6��}�}�Q��%�%��,��D�M�M�"�1�$��t�}�}�Q�'��1��}�}�Q��%�%��,������ �����
�!���]�]�E��z�z�T�\�\�)���$�����t�}�}�,�#�� %�
����t�0�0�0�$)�!��u�g�&�5�;�;�#�+=�$(�!�#���
�
�a�(�I��y�'�*�y���#�/E� �M�M�!�,�	��
�
�a�(�I��>�>�\�.�.�.����%�'�"��1���<����9�&�G�L�)�/�/�,R�S�H�&�G�F�I�O�O�,L�M�H�
�^�^�|�2�2�
2��?�?�(�(��-�D��v�~�"��t��5��"��(9�(9��E��
�^�^�t�0�0�
0�"�#4�f�=�H���%�%�a�(�.�.�#�5����'�'��*�0�0�C�7��*�)��H�0�%�.�.�q��4��%�e�X�6���&��%�%�,�,�W�5�	5�
� ����Orc����	t|t�s|St|�dk(r|dSg}g}gd��g}d�|D]~}tt	|d���s�tt	|�fd���r|j|��Dtt	|�fd���r|j|��n|j|���|r|}n	|r|}n|r|}t
|t��S)	Nrr5)�in�for�if�not�Nonez[]().,:c�$�t|�tuSr)rr)�xs r�<lambda>z/get_characteristic_subpattern.<locals>.<lambda>�s��d�1�g��nrc�0��t|t�xr|�vSr�rGr)rb�common_charss �rrcz/get_characteristic_subpattern.<locals>.<lambda>�s���j��C�&8�&N�Q�,�=N�&Nrc�0��t|t�xr|�vSrre)rb�common_namess �rrcz/get_characteristic_subpattern.<locals>.<lambda>s���
�1�c�(:�(P�q�L�?P�(Pr)�key)rG�listr!r<�rec_testr �max)�subpatterns�subpatterns_with_names�subpatterns_with_common_names�subpatterns_with_common_chars�
subpatternrfrhs     @@rr$r$�s������k�4�(���
�;�����1�~�� ��$&�!�6�L�$&�!��L�!�
��x�
�$<�=�>��8�J�N�P�Q�-�4�4�Z�@��X�j�P�R�S�-�4�4�Z�@�'�-�-�j�9�"��,��	&�3��	&�3���{��$�$rc#�K�	|D]7}t|ttf�rt||�Ed{����.||����9y7��wr)rGrjr"rk)�sequence�	test_funcrbs   rrkrks@�����
���a�$���'���9�-�-�-��A�,��	�-�s�,A�A�Ar)�r�pgen2rr�pygramrrr@rN�opmaprQr%rLrr#�objectrrCr$rkr3rr�<module>rzsZ��2��!�3���	��	������
����
�
�U�f�U�nB�J#%�Jr

?>