Your IP : 3.12.153.240


Current Path : /opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/fixer_util.cpython-311.opt-2.pyc

�

c��ff;���	ddlmZddlmZmZddlmZddlm	Z	d�Z
d�Zd�Zd�Z
d,d
�Zd�Zd�Zd
�Ze��e��fd�Zd-d�Zd�Zd�Zd,d�Zd�Zd,d�Zd,d�Zd�Zd�Zd�Zd�Zd�Zhd�Zd�Z da!da"da#d a$d!�Z%d"�Z&d#�Z'd$�Z(d%�Z)d&�Z*d'�Z+d(�Z,ej-ej.hZ/d,d)�Z0ej.ej-ej1hZ2d*�Z3d,d+�Z4d	S).�)�token)�Leaf�Node)�python_symbols)�patcompc�l�ttj|ttjd��|g��S)N�=)r�syms�argumentrr�EQUAL)�keyword�values  �9/opt/alt/python311/lib64/python3.11/lib2to3/fixer_util.py�
KeywordArgrs.����
��$�u�{�C�0�0�%�8�:�:�:�c�6�ttjd��S)N�()rr�LPAR�rr�LParenr�����
�C� � � rc�6�ttjd��S)N�))rr�RPARrrr�RParenrrrc	���	t|t��s|g}t|t��s
d|_|g}ttj|t
tjdd���gz|z��S)N� r	��prefix)	�
isinstance�listrrr
�atomrrr)�target�sources  r�Assignr%sx��'��f�d�#�#������f�d�#�#����
������	��$�u�{�C��<�<�<�=�=��F�H�H�HrNc�<�	ttj||���S�Nr)rr�NAME)�namers  r�Namer*$s�����
�D��0�0�0�0rc�X�	|ttjt��|g��gS�N)rr
�trailer�Dot)�obj�attrs  r�Attrr1(s$��#���d�l�S�U�U�D�M�2�2�3�3rc�8�	ttjd��S)N�,)rr�COMMArrr�Commar5,s������S�!�!�!rc�8�	ttjd��S)N�.)rr�DOTrrrr.r.0s�����	�3���rc���	ttj|���|���g��}|r.|�dttj|����|S)Nr)rr
r-�clone�insert_child�arglist)�args�lparen�rparen�nodes    r�ArgListrA4sZ��7����v�|�|�~�~�v�|�|�~�~�>�?�?�D��7����!�T�$�,��5�5�6�6�6��Krc�l�	ttj|t|��g��}|�||_|Sr,)rr
�powerrAr)�	func_namer=rr@s    r�CallrE;s3�����
�Y���
�
�6�7�7�D�
������Krc�8�	ttjd��S)N�
�rr�NEWLINErrr�NewlinerJBs�����
�t�$�$�$rc�8�	ttjd��S)N�rHrrr�	BlankLinerMFs�����
�r�"�"�"rc�:�ttj||���Sr')rr�NUMBER)�nrs  r�NumberrQJs�����a��/�/�/�/rc	��	ttjttjd��|ttjd��g��S)N�[�])rr
r-rr�LBRACE�RBRACE)�
index_nodes r�	SubscriptrXMs@��'����t�E�L�#�6�6�)�#�E�L�#�6�6�8�9�9�9rc�<�	ttj||���Sr')rr�STRING)�stringrs  r�Stringr\Ss������f�V�4�4�4�4rc	�r�	d|_d|_d|_ttjd��}d|_ttjd��}d|_||||g}|rWd|_ttjd��}d|_|�ttj||g����ttj|ttj	|��g��}ttj
ttjd��|ttjd��g��S)NrLr�for�in�ifrSrT)
rrrr(�appendrr
�comp_if�	listmaker�comp_forr"rUrV)	�xp�fp�it�test�for_leaf�in_leaf�
inner_args�if_leaf�inners	         r�ListComprnWs����B�I��B�I��B�I��E�J��&�&�H��H�O��5�:�t�$�$�G��G�N��B���,�J��?�����u�z�4�(�(��������$�t�|�g�t�_�=�=�>�>�>����"�d�4�=�*�&E�&E�!F�G�G�E���	��U�\�3�/�/���U�\�3�/�/�1�2�2�2rc�B�	|D]}|����ttjd��ttj|d���ttjdd���t	t
j|��g}t	t
j|��}|S)N�fromrr�import)�removerrr(rr
�import_as_names�import_from)�package_name�
name_leafs�leaf�children�imps     r�
FromImportrzos���*��������
�
�
�
��U�Z��(�(��U�Z��c�:�:�:��U�Z��#�6�6�6��T�)�:�6�6�8�H��t���
*�
*�C��Jrc�n�	|d���}|jtjkr|���}n-t	tj|���g��}|d}|rd�|D��}t	tjt
t|d��t|d����t	tj|d���||d���g��gz|z��}|j	|_	|S)Nr/�afterc�6�g|]}|�����Sr)r:)�.0rPs  r�
<listcomp>z!ImportAndCall.<locals>.<listcomp>�s ��*�*�*�q������*�*�*r�r�lpar�rpar)
r:�typer
r<rrCr1r*r-r)r@�results�namesr/�
newarglistr|�news       r�
ImportAndCallr��s���
�%�.�
�
�
 �
 �C�
�x�4�<����Y�Y�[�[�
�
��$�,������
�6�6�
��G��E��+�*�*�E�*�*�*��
�t�z��D��q��N�N�D��q��N�N�3�3��T�\��f�o�+�+�-�-� ��f�o�+�+�-�-�/�0�0�1�1�49�	9�:�:�C���C�J��Jrc���	t|t��r'|jt��t	��gkrdSt|t��o�t|j��dko�t|jdt��okt|jdt��oKt|jdt��o+|jdjdko|jdjdkS)NT�r�r�rr)r rrxrr�lenrr�r@s r�is_tupler��s���2��$�����$�-�F�H�H�f�h�h�3G�"G�"G��t��t�T�"�"�
.��D�M�"�"�a�'�
.��4�=��+�T�2�2�
.��4�=��+�T�2�2�
.��4�=��+�T�2�2�	
.�
�
�a� �&�#�-�
.��
�a� �&�#�-�
/rc�6�	t|t��o�t|j��dkokt|jdt��oKt|jdt��o+|jdjdko|jdjdkS)Nrr����rSrT)r rr�rxrrr�s r�is_listr��s���1��t�T�"�"�
/��D�M�"�"�Q�&�
/��4�=��+�T�2�2�
/��4�=��,�d�3�3�
/��
�a� �&�#�-�	
/�
�
�b�!�'�3�.�0rc�l�ttjt��|t	��g��Sr,)rr
r"rrr�s r�parenthesizer��s#����	�F�H�H�d�F�H�H�5�6�6�6r>
�all�any�max�min�set�sumr!�tuple�sorted�	enumeratec#�`K�	t||��}|r|V�t||��}|�dSdSr,)�getattr)r/r0�nexts   r�
attr_chainr��sZ������3����D�
�#��
�
�
��t�T�"�"���#�#�#�#�#rzefor_stmt< 'for' any 'in' node=any ':' any* >
        | comp_for< 'for' any 'in' node=any any* >
     z�
power<
    ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' |
      'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) )
    trailer< '(' node=any ')' >
    any*
>
z`
power<
    ( 'sorted' | 'enumerate' )
    trailer< '(' arglist<node=any any*> ')' >
    any*
>
Fc�j�	tsMtjt��atjt��atjt
��adattt
g}t
|t|d����D]*\}}i}|�||��r
|d|urdS�+dS)NT�parentr@F)	�
pats_builtr�compile_pattern�p0�p1�p2�zipr��match)r@�patterns�patternr�r�s     r�in_special_contextr��s������
�
$�R�
(�
(��
�
$�R�
(�
(��
�
$�R�
(�
(���
��B��|�H��x��D�(�)C�)C�D�D���������=�=���)�)�	�g�f�o��.E�.E��4�4���5rc��	|j}|�|jtjkrdS|j}|jt
jt
jfvrdS|jt
jkr|j	d|urdS|jt
j
ks;|jt
jkr(|�|jtjks|j	d|urdSdS)NFr�T)
�prev_siblingr�rr8r�r
�funcdef�classdef�	expr_stmtrx�
parameters�
typedargslistr4)r@�prevr�s   r�is_probably_builtinr��s������D���D�I���2�2��u�
�[�F�
�{�t�|�T�]�3�3�3��u�
�{�d�n�$�$����);�t�)C�)C��u�
�{�d�o�%�%�
�[�D�.�
.�
.�
�
�$�)�u�{�":�":��O�A��$�&�&��u��4rc���	|�_|jtjkrAt|j��dkr)|jd}|jt
jkr|jS|j}|�_dS)Nr�rrL)	r�r
�suiter�rxr�INDENTrr�)r@�indents  r�find_indentationr�sg��)�
�
��9��
�"�"�s�4�=�'9�'9�A�'=�'=��]�1�%�F��{�e�l�*�*��|�#��{���
��2rc��|jtjkr|S|���}|jdc}|_ttj|g��}||_|Sr,)r�r
r�r:r�r)r@r�r�s   r�
make_suiter�sR���y�D�J������:�:�<�<�D��+�t��F�D�K����d�V�$�$�E��E�L��Lrc��	|jtjkr-|j}|st	d���|jtjk�-|S)Nz,root found before file_input node was found.)r�r
�
file_inputr��
ValueErrorr�s r�	find_rootr�&sK��'�
�)�t��
&�
&��{���	M��K�L�L�L��)�t��
&�
&��Krc�^�	t|t|��|��}t|��Sr,)�find_bindingr��bool)�packager)r@�bindings    r�does_tree_importr�/s,��9��4��4���'�:�:�G���=�=�rc�B�	|jtjtjfvSr,)r�r
�import_namertr�s r�	is_importr�7s��:��9��)�4�+;�<�<�<rc	�H�	d�}t|��}t|||��rdSdx}}t|j��D]E\}}||��s�t|j|d���D]\}}||��sn�||z}|dkr]t|j��D]H\}}|jt
jkr.|jr'|jdjtjkr|dz}n�I|�Ott
j
ttjd��ttj|d���g��}	n+t|ttj|d���g��}	|	t��g}
|�|tt
j|
����dS)Nc�n�|jtjko |jot	|jd��S)Nr�)r�r
�simple_stmtrxr�r�s r�is_import_stmtz$touch_import.<locals>.is_import_stmt>s4���	�T�-�-�,�$�-�,��$�-��*�+�+�	-rr�rrqrr)r�r�r�rxr�r
r�rrZrr�rr(rzrJr;)r�r)r@r��root�
insert_pos�offset�idx�node2�import_rxs           r�touch_importr�;s���$�-�-�-��T�?�?�D����t�,�,������J���t�}�-�-���	��T��~�d�#�#�	��&�t�}�S�T�T�':�;�;�	�	�M�F�E�!�>�%�(�(�
���
��6�\�
�
��Q���"�4�=�1�1�	�	�I�C���	�T�-�-�-�$�-�-��}�Q��$���4�4� �1�W�
�������t�'����X�&�&����T�#�.�.�.�*
�����
�W�t�E�J��S�'I�'I�'I�&J�K�K������#�H����j�$�t�'7��"B�"B�C�C�C�C�Crc
�R�	|jD�]}d}|jtjkrNt	||jd��r|cSt|t
|jd��|��}|r|}�n�|jtjtjfvr/t|t
|jd��|��}|r|}�nK|jtj	kr�t|t
|jd��|��}|r|}�nt|jdd���D]U\}}|jtjkr;|j
dkr0t|t
|j|dz��|��}|r|}�Vn�|jtvr|jdj
|kr|}nmt|||��r|}nY|jtjkrt|||��}n2|jtjkrt	||jd��r|}|r|s|cSt%|��r|cS��dS)Nrr�r�r��:�r�)rxr�r
�for_stmt�_findr�r��if_stmt�
while_stmt�try_stmtr�r�COLONr�	_def_syms�_is_import_bindingr�r�r�)r)r@r��child�retrP�i�kids        rr�r�is8��(���"�"�����:���&�&��T�5�>�!�,�-�-�
������T�:�e�n�R�.@�#A�#A�7�K�K�A��M��#��
�Z�D�L�$�/�:�
:�
:��T�:�e�n�R�.@�#A�#A�7�K�K�A��M��#��
�Z�4�=�
(�
(��T�:�e�n�Q�.?�#@�#@�'�J�J�A��
&����'���q�r�r�(:�;�;�&�&�F�A�s��x�5�;�.�.�3�9��3C�3C�(��z�%�.��1��:M�/N�/N�PW�X�X���
�A�c��	&�
�Z�9�
$�
$����):�)@�D�)H�)H��C�C�
��t�W�
5�
5�	��C�C�
�Z�4�+�
+�
+��t�U�G�4�4�C�C�
�Z�4�>�
)�
)��T�5�>�!�,�-�-�
����	��
��
�
�
���~�~�
��
�
�
���4rc���|g}|rl|���}|jdkr)|jtvr|�|j��n"|jt
jkr
|j|kr|S|�ldS)N�)�popr��_block_syms�extendrxrr(r)r)r@�nodess   rr�r��s}��
�F�E�
���y�y�{�{���9�s�?�?�t�y��;�;��L�L���'�'�'�'�
�Y�%�*�
$�
$���t�);�);��K����4rc�0�	|jtjkr�|s�|jd}|jtjkr`|jD]V}|jtjkr|jdj|kr|cS�2|jtjkr|j|kr|cS�W�n{|jtjkr1|jd}|jtjkr
|j|kr|S�n5|jtjkr
|j|kr|S�n|jtj	kr�|r2t|jd�����|krdS|jd}|rtd|��rdS|jtj
krt||��r|S|jtjkr0|jd}|jtjkr
|j|kr|Sn;|jtjkr
|j|kr|S|r|jtjkr|SdS)Nrr�r�r��as)r�r
r�rx�dotted_as_names�dotted_as_namerrr(rt�str�stripr�rs�import_as_name�STAR)r@r)r�ryr��lastrPs       rr�r��s��)��y�D�$�$�$�W�$��m�A����8�t�+�+�+���
 �
 ���:��!4�4�4��~�a�(�.�$�6�6�#����7��Z�5�:�-�-�%�+��2E�2E��K�K�K��
 ��X��,�
,�
,��<��#�D��y�E�J�&�&�4�:��+=�+=����
�X���
#�
#��	�T�(9�(9��K��	
��d�&�	&�	&��	�s�4�=��+�,�,�2�2�4�4��?�?��4��M�!����	�u�T�1�~�~�	��4�
�V�t�+�
+�
+��d�A���
+��K�
�V�t�*�
*�
*��J�q�M�E��z�U�Z�'�'�E�K�4�,?�,?����
�V�u�z�
!�
!�a�g��o�o��K�
�	���5�:�-�-��K��4rr,)NN)5�pgen2r�pytreerr�pygramrr
rLrrrrr%r*r1r5r.rArErJrMrQrXr\rnrzr�r�r�r��consuming_callsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r-r�r�r�rrr�<module>r�s���7���������������*�*�*�*�*�*�������:�:�:�!�!�!�!�!�!�	H�	H�	H�1�1�1�1�4�4�4�"�"�"� � � � ����&�&�(�(���������%�%�%�#�#�#�0�0�0�0�9�9�9�5�5�5�5�2�2�2�2�0���&���8
/�
/�
/�0�0�0�7�7�7�.�.�.��#�#�#�&	�������
����&���.������������=�=�=�*D�*D�*D�Z�]�D�L�)�	�(�(�(�(�T�|�T�]�D�L�9�����'�'�'�'�'�'r

?>