AlkantarClanX12

Your IP : 18.117.94.77


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_except.cpython-312.opt-1.pyc

�

�Q�f
��|�dZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZmZd�Z
Gd�dej�Zy	)
a�Fixer for except statements with named exceptions.

The following cases will be converted:

- "except E, T:" where T is a name:

    except E as T:

- "except E, T:" where T is not a name, tuple or list:

        except E as t:
            T = t

    This is done because the target of an "except" clause must be a
    name.

- "except E, T:" where T is a tuple or list literal:

        except E as t:
            T = t.args
�)�pytree)�token)�
fixer_base)�Assign�Attr�Name�is_tuple�is_list�symsc#�K�t|�D]L\}}|jtjk(s�$|jdj
dk(s�A|||dzf���Ny�w)N��exceptr)�	enumerate�typer�
except_clause�children�value)�nodes�i�ns   �?/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_except.py�find_exceptsrsS�����%� ���1��6�6�T�'�'�'��z�z�!�}�"�"�h�.��%��!��*�o�%�!�s�/A�A�Ac��eZdZdZdZd�Zy)�	FixExceptTa1
    try_stmt< 'try' ':' (simple_stmt | suite)
                  cleanup=(except_clause ':' (simple_stmt | suite))+
                  tail=(['except' ':' (simple_stmt | suite)]
                        ['else' ':' (simple_stmt | suite)]
                        ['finally' ':' (simple_stmt | suite)]) >
    c
��|j}|dD�cgc]}|j���}}|dD�cgc]}|j���}}t|�D�]�\}}	t|j�dk(s� |jdd\}
}}|jt
dd���|jtjk7�r	t
|j�d��}
|j�}d|_|j|
�|
j�}
|	j}t|�D]!\}}t|tj�s�!nt!|�st#|�r t%|t'|
t
d	���}nt%||
�}t)|d�D]}|	j+d
|��|	j+||���v|jdk(s���d|_���|jddD�cgc]}|j���c}|z|z}tj|j|�Scc}wcc}wcc}w)N�tail�cleanup���as� )�prefix��argsr
�)r�cloner�lenr�replacerrr�NAME�new_namer"r�
isinstancer�Noder	r
rr�reversed�insert_child)�self�node�resultsrrr�ch�try_cleanupr�e_suite�E�comma�N�new_N�target�suite_stmtsr�stmt�assign�child�crs                      r�	transformzFixExcept.transform/s����y�y��#*�6�?�3�?�a����	�?��3�,3�I�,>�?�,>�b�r�x�x�z�,>��?�&2�;�&?�"�M�7��=�)�)�*�a�/� -� 6� 6�q�� ;�
��E�1��
�
�d�4��4�5��6�6�U�Z�Z�'� ������=�E��W�W�Y�F�$&�F�M��I�I�e�$�!�K�K�M�E�#*�"2�"2�K�#,�[�#9���4�%�d�F�K�K�8�!�$:� ��{�g�a�j�!'���U�D��L�0I�!J��!'���!6��"*�+�b�q�/�!:���,�,�Q��6�";��(�(��F�3��X�X��^� #�A�H�I'@�N(,�}�}�R�a�'8�9�'8�!�A�G�G�I�'8�9�K�G�$�N���{�{�4�9�9�h�/�/��W4��?��P:s�H:�H?�:IN)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr?��rrr$s���M��G�.0rFrN)�__doc__r#r�pgen2rr�
fixer_utilrrrr	r
rr�BaseFixrrErFr�<module>rKs2���0���D�D�&�90�
�"�"�90rF