Your IP : 18.191.192.113


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

�

�Q�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,ejZej\hZ/d,d)�Z0ej\ejZejbhZ2d*�Z3d,d+�Z4y	).�)�token)�Leaf�Node)�python_symbols)�patcompc�l�ttj|ttj
d�|g�S)N�=)r�syms�argumentrr�EQUAL)�keyword�values  �9/opt/alt/python312/lib64/python3.12/lib2to3/fixer_util.py�
KeywordArgrs*����
�
��$�u�{�{�C�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%s`��'��f�d�#�����f�d�#���
������	�	��$�u�{�{�C��<�=�=��F�H�HrNc�<�	ttj||��S�Nr)rr�NAME)�namers  r�Namer*$s�����
�
�D��0�0rc�P�	|ttjt�|g�gS�N)rr
�trailer�Dot)�obj�attrs  r�Attrr1(s!��#���d�l�l�S�U�D�M�2�3�3rc�8�	ttjd�S)N�,)rr�COMMArrr�Commar5,s�������S�!�!rc�8�	ttjd�S)N�.)rr�DOTrrrr.r.0s�����	�	�3��rc���	ttj|j�|j�g�}|r*|j	dttj
|��|S)Nr)rr
r-�clone�insert_child�arglist)�args�lparen�rparen�nodes    r�ArgListrA4sI��7�����v�|�|�~�v�|�|�~�>�?�D�����!�T�$�,�,��5�6��Krc�d�	ttj|t|�g�}|�||_|Sr,)rr
�powerrAr)�	func_namer=rr@s    r�CallrE;s0�����
�
�Y���
�6�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	��	ttjttj
d�|ttjd�g�S)N�[�])rr
r-rr�LBRACE�RBRACE)�
index_nodes r�	SubscriptrXMs;��'�����t�E�L�L�#�6�)�#�E�L�L�#�6�8�9�9rc�<�	ttj||��Sr')rr�STRING)�stringrs  r�Stringr\Ss�������f�V�4�4rc	�j�	d|_d|_d|_ttjd�}d|_ttjd�}d|_||||g}|rSd|_ttjd�}d|_|j	ttj||g��ttj|ttj|�g�}ttjttjd�|ttjd�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�J��&�H��H�O��5�:�:�t�$�G��G�N��B���,�J������u�z�z�4�(��������$�t�|�|�g�t�_�=�>�����"�d�4�=�=�*�&E�!F�G�E���	�	��U�\�\�3�/���U�\�\�3�/�1�2�2rc�>�	|D]}|j��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�Z��(��U�Z�Z��c�:��U�Z�Z��#�6��T�)�)�:�6�8�H��t����
*�C��Jrc�P�	|dj�}|jtjk(r|j�}n)t	tj|j�g�}|d}|r|D�cgc]}|j���}}t	tj
t
t|d�t|d��t	tj|dj�||dj�g�gz|z�}|j|_	|Scc}w)Nr/�after�r�lpar�rpar)
r:�typer
r<rrCr1r*r-r)r@�results�namesr/�
newarglistr|rP�news        r�
ImportAndCallr��s���
�%�.�
�
�
 �C�
�x�x�4�<�<���Y�Y�[�
��$�,�,�����
�6�
��G��E��$)�*�E�q�����E��*�
�t�z�z��D��q��N�D��q��N�3��T�\�\��f�o�+�+�-� ��f�o�+�+�-�/�0�1�1�49�	9�:�C����C�J��J��+s�7D#c���	t|t�r"|jt�t	�gk(ryt|t�xr�t|j�dk(xr�t|jdt�xrxt|jdt�xrYt|jdt�xr:|jdjdk(xr|jdjdk(S)NT�r}r�rr)r rrxrr�lenrr�r@s r�is_tupler��s���2��$���$�-�-�F�H�f�h�3G�"G���t�T�"�
.��D�M�M�"�a�'�
.��4�=�=��+�T�2�
.��4�=�=��+�T�2�
.��4�=�=��+�T�2�	
.�
�
�
�a� �&�&�#�-�
.��
�
�a� �&�&�#�-�
/rc�L�	t|t�xr�t|j�dkDxrxt|jdt�xrYt|jdt�xr:|jdj
dk(xr|jdj
dk(S)Nrr}���rSrT)r rr�rxrrr�s r�is_listr��s���1��t�T�"�
/��D�M�M�"�Q�&�
/��4�=�=��+�T�2�
/��4�=�=��,�d�3�
/��
�
�a� �&�&�#�-�	
/�
�
�
�b�!�'�'�3�.�0rc�\�ttjt�|t	�g�Sr,)rr
r"rrr�s r�parenthesizer��s����	�	�F�H�d�F�H�5�6�6r>
�all�any�max�min�set�sumr!�tuple�sorted�	enumeratec#�RK�	t||�}|r|��t||�}|r�yy�wr,)�getattr)r/r0�nexts   r�
attr_chainr��s2������3���D�
��
��t�T�"���s�"'�'zefor_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�F�	tsMtjt�atjt�atjt
�adattt
g}t
|t|d��D]#\}}i}|j||�s�|d|us�#yy)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�D�������=�=���)�g�f�o��.E��E�rc��	|j}|�|jtjk(ry|j}|jt
jt
jfvry|jt
jk(r|jd|ury|jt
jk(sM|jt
jk(r1|�|jtjk(s|jd|uryy)NFr}T)
�prev_siblingr�rr8r�r
�funcdef�classdef�	expr_stmtrx�
parameters�
typedargslistr4)r@�prevr�s   r�is_probably_builtinr��s�������D���D�I�I����2��
�[�[�F�
�{�{�t�|�|�T�]�]�3�3��
�{�{�d�n�n�$�����);�t�)C��
�{�{�d�o�o�%�
�[�[�D�.�.�
.�
�
�$�)�)�u�{�{�":��O�O�A��$�&��rc��	|�||jtjk(rPt|j�dkDr8|jd}|jt
jk(r|jS|j}|��|y)Nr�rrL)	r�r
�suiter�rxr�INDENTrr�)r@�indents  r�find_indentationr�si��)�
�
��9�9��
�
�"�s�4�=�=�'9�A�'=��]�]�1�%�F��{�{�e�l�l�*��|�|�#��{�{���
�rc���|jtjk(r|S|j�}|jdc}|_ttj|g�}||_|Sr,)r�r
r�r:r�r)r@r�r�s   r�
make_suiter�sR���y�y�D�J�J�����:�:�<�D��+�+�t��F�D�K�����d�V�$�E��E�L��Lrc��	|jtjk7r7|j}|st	d��|jtjk7r�7|S)Nz,root found before file_input node was found.)r�r
�
file_inputr��
ValueErrorr�s r�	find_rootr�&sF��'�
�)�)�t���
&��{�{����K�L�L��)�)�t���
&��Krc�F�	t|t|�|�}t|�Sr,)�find_bindingr��bool)�packager)r@�bindings    r�does_tree_importr�/s%��9��4��4��'�:�G���=�rc�\�	|jtjtjfvSr,)r�r
�import_namertr�s r�	is_importr�7s%��:��9�9��)�)�4�+;�+;�<�<�<rc	�J�	d�}t|�}t|||�rydx}}t|j�D]>\}}||�s�t|j|d�D]\}}||�r�n||z}n|dk(ryt|j�D]a\}}|jt
jk(s�$|js�1|jdjtjk(s�\|dz}n|�Ott
jttjd�ttj|d��g�}	n't|ttj|d��g�}	|	t�g}
|j|tt
j|
��y)Nc��|jtjk(xr&|jxrt	|jd�S)Nr})r�r
�simple_stmtrxr�r�s r�is_import_stmtz$touch_import.<locals>.is_import_stmt>s:���	�	�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�;sm��$�-��T�?�D����t�,����J���t�}�}�-�	��T��d�#��&�t�}�}�S�T�':�;�M�F�E�!�%�(��<��6�\�
�
�.��Q��"�4�=�=�1�I�C���	�	�T�-�-�-�$�-�-��}�}�Q��$�$����4� �1�W�
��	2����t�'�'�����X�&�����T�#�.�*
���
�W�t�E�J�J��S�'I�&J�K�����#�H����j�$�t�'7�'7��"B�Crc
��	|jD�]<}d}|jtjk(rGt	||jd�r|cSt|t
|jd�|�}|�r�|}�n�|jtjtjfvr*t|t
|jd�|�}|�rh|}�nd|jtjk(r�t|t
|jd�|�}|r|}�nt|jdd�D]^\}}|jtjk(s�$|jdk(s�4t|t
|j|dz�|�}|s�]|}�`n�|jtvr|jdj|k(r|}nst|||�r|}nc|jtj k(rt|||�}n8|jtj"k(rt	||jd�r|}|s��(|s|cSt%|�s��;|cSy)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�is���(��������:�:����&��T�5�>�>�!�,�-����T�:�e�n�n�R�.@�#A�7�K�A���#�
�Z�Z�D�L�L�$�/�/�:�
:��T�:�e�n�n�R�.@�#A�7�K�A���#�
�Z�Z�4�=�=�
(��T�:�e�n�n�Q�.?�#@�'�J�A����'����q�r�(:�;�F�A�s��x�x�5�;�;�.�3�9�9��3C�(��z�%�.�.��1��:M�/N�PW�X���A�c�	<�
�Z�Z�9�
$�����):�)@�)@�D�)H��C�
��t�W�
5��C�
�Z�Z�4�+�+�
+��t�U�G�4�C�
�Z�Z�4�>�>�
)��T�5�>�>�!�,�-������
���~��
�E�Frc�
�|g}|r~|j�}|jdkDr.|jtvr|j|j�n.|jt
jk(r|j|k(r|S|r�~y)N�)�popr��_block_syms�extendrxrr(r)r)r@�nodess   rr�r��sg��
�F�E�
��y�y�{���9�9�s�?�t�y�y��;��L�L����'�
�Y�Y�%�*�*�
$����t�);��K��rc�.�	|jtjk(�r9|�s6|jd}|jtjk(r�|jD]q}|jtj
k(r!|jdj|k(s�=|cS|jtjk(s�_|j|k(s�o|cSy|jtj
k(r=|jd}|jtjk(r?|j|k(r0|S|jtjk(r|j|k(r|Sy|jtjk(�r|r*t|jd�j�|k7ry|jd}|r
td|�ry|jtjk(rt||�r|S|jtjk(r>|jd}|jtjk(r|j|k(r|Sy|jtjk(r|j|k(r|S|r|jtjk(r|Sy)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�y�D�$�$�$�W��m�m�A����8�8�t�+�+�+������:�:��!4�!4�4��~�~�a�(�.�.�$�6�#���Z�Z�5�:�:�-�%�+�+��2E��K�&�>�3�X�X��,�,�
,��<�<��#�D��y�y�E�J�J�&�4�:�:��+=���
�X�X����
#��	�	�T�(9��K�(�'
���d�&�&�	&��s�4�=�=��+�,�2�2�4��?���M�M�!����u�T�1�~��
�V�V�t�+�+�
+��d�A���K�
�V�V�t�*�*�
*��J�J�q�M�E��z�z�U�Z�Z�'�E�K�K�4�,?���
�	�V�V�u�z�z�
!�a�g�g��o��K�
����5�:�:�-��K�rr,)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�1�4�"� � ��&�(���%�#�0�9�5�2�0�&�8
/�0�7�.��#�&	�������
��&�.����=�*D�Z�]�]�D�L�L�)�	�(�T�|�|�T�]�]�D�L�L�9���'r

?>