Your IP : 3.146.255.135


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

�

�Q�f��d�	ddlmZddlmZmZmZmZmZmZdZ	dZ
Gd�dej�Zy)�)�
fixer_base)�Call�Comma�Name�Node�	BlankLine�symsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >c	�X��eZdZdZde�de�de�de�d�	Z�fd�Zd�Zd�Z	d	�Z
d
�Z�xZS)�	FixIdiomsTz 
        isinstance=comparison< � z8 T=any >
        |
        isinstance=comparison< T=any aX >
        |
        while_stmt< 'while' while='1' ':' any+ >
        |
        sorted=any<
            any*
            simple_stmt<
              expr_stmt< id1=any '='
                         power< list='list' trailer< '(' (not arglist<any+>) any ')' > >
              >
              '\n'
            >
            sort=
            simple_stmt<
              power< id2=any
                     trailer< '.' 'sort' > trailer< '(' ')' >
              >
              '\n'
            >
            next=any*
        >
        |
        sorted=any<
            any*
            simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' >
            sort=
            simple_stmt<
              power< id2=any
                     trailer< '.' 'sort' > trailer< '(' ')' >
              >
              '\n'
            >
            next=any*
        >
    c�V��tt|�|�}|rd|vr|d|dk(r|Sy|S)N�sorted�id1�id2)�superr�match)�self�node�r�	__class__s   ��?/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_idioms.pyrzFixIdioms.matchOs<����)�T�(��.��
��Q����x�1�U�8�#������c��d|vr|j||�Sd|vr|j||�Sd|vr|j||�Std��)N�
isinstance�whilerz
Invalid match)�transform_isinstance�transform_while�transform_sort�RuntimeError)rr�resultss   r�	transformzFixIdioms.transformZs^���7�"��,�,�T�7�;�;�
��
��'�'��g�6�6�
��
 ��&�&�t�W�5�5���/�/rc�0�|dj�}|dj�}d|_d|_ttd�|t	�|g�}d|vr,d|_ttjtd�|g�}|j|_|S)N�x�T�rr�n�not)�clone�prefixrrrrr	�not_test)rrr r#r$�tests      rrzFixIdioms.transform_isinstanceds����C�L��� ���C�L��� ���������D��&��E�G�Q��8���'�>��D�K���
�
��U��T�':�;�D��k�k����rc�Z�|d}|jtd|j���y)Nr�True�r))�replacerr))rrr �ones    rrzFixIdioms.transform_whileps#���g������D���
�
�3�4rc��|d}|d}|jd�}|jd�}|r'|jtd|j���nV|rI|j	�}d|_|jttd�|g|j���nt
d��|j�|j}d	|vr~|r=|jd	�d
|d
jf}	d	j|	�|d
_yt�}
|jj|
�|jd	�d
|
_yy)N�sort�next�list�exprrr.r%zshould not have reached here�
�)
�getr/rr)r(rr�remove�
rpartition�joinr�parent�append_child)rrr �	sort_stmt�	next_stmt�	list_call�simple_expr�new�btwn�prefix_lines�end_lines           rrzFixIdioms.transform_sortts3���F�O�	��F�O�	��K�K��'�	��k�k�&�)������d�8�I�4D�4D�E�F�
��#�#�%�C��C�J�����T�(�^�c�U�,7�,>�,>�!@�
A��=�>�>����������4�<��!%���� 5�a� 8�)�A�,�:M�:M�N��&*�i�i��&=�	�!��#�
%�;��� � �-�-�h�7�#'�/�/�$�"7��":���!r)
�__name__�
__module__�__qualname__�explicit�TYPE�CMP�PATTERNrr!rrr�
__classcell__)rs@rrr%s6����H�N��c�4�K%!�G�N	�0�
�5�$;rrN)
r%r�
fixer_utilrrrrrr	rKrJ�BaseFixr�rr�<module>rQs3���<�A�A�8��1��s;�
�"�"�s;r

?>