Your IP : 3.145.43.92


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

�

c��f
��z�dZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZmZd�Z
Gd�dej��Zd	S)
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]?\}}|jtjkr%|jdjdkr|||dzfV��@dS)N��exceptr)�	enumerate�typer�
except_clause�children�value)�nodes�i�ns   �?/opt/alt/python311/lib64/python3.11/lib2to3/fixes/fix_except.py�find_exceptsrsh�����%� � �&�&���1��6�T�'�'�'��z�!�}�"�h�.�.��%��!��*�o�%�%�%��&�&�c��eZdZdZdZd�ZdS)�	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�|j}d�|dD��}d�|dD��}t|��D�]�\}}t|j��dk�r�|jdd�\}}	}
|	�tdd�	����|
jtjk�rAt|�	��d�	��}|
�
��}d
|_|
�|��|�
��}|j}
t|
��D]!\}}t|tj��rn�"t!|
��st#|
��r,t%|t'|td������}nt%||��}t)|
d|���D]}|�d|���|�||�����|
jd
krd|
_���d
�|jdd�D��|z|z}tj|j|��S)Nc�6�g|]}|�����S���clone)�.0rs  r�
<listcomp>z'FixExcept.transform.<locals>.<listcomp>2s ��3�3�3�a����	�	�3�3�3r�tailc�6�g|]}|�����Srr)r!�chs  rr"z'FixExcept.transform.<locals>.<listcomp>4s ��?�?�?�b�r�x�x�z�z�?�?�?r�cleanup���as� )�prefix��argsr
c�6�g|]}|�����Srr)r!�cs  rr"z'FixExcept.transform.<locals>.<listcomp>\s ��9�9�9�!�A�G�G�I�I�9�9�9r�)rr�lenr�replacerrr�NAME�new_namer r+r�
isinstancer�Noder	r
rr�reversed�insert_child)�self�node�resultsrr#�try_cleanupr�e_suite�E�comma�N�new_N�target�suite_stmtsr�stmt�assign�childrs                   r�	transformzFixExcept.transform/s2���y��3�3�7�6�?�3�3�3��?�?�G�I�,>�?�?�?��&2�;�&?�&?�$	#�$	#�"�M�7��=�)�*�*�a�/�/� -� 6�q��s� ;�
��E�1��
�
�d�4��4�4�4�5�5�5��6�U�Z�'�'� �������=�=�=�E��W�W�Y�Y�F�$&�F�M��I�I�e�$�$�$�!�K�K�M�M�E�#*�"2�K�#,�[�#9�#9�"�"���4�%�d�F�K�8�8�"�!�E�"�
 ��{�{�7�g�a�j�j�7�!'���U�D��L�L�0I�0I�!J�!J���!'���!6�!6��"*�+�b�q�b�/�!:�!:�7�7���,�,�Q��6�6�6�6��(�(��F�3�3�3�3��X��^�^� #�A�H��:�9�t�}�R�a�R�'8�9�9�9�K�G�$�N���{�4�9�h�/�/�/rN)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNrGrrrrr$s/�������M��G�.0�.0�.0�.0�.0rrN)�__doc__r,r�pgen2rr�
fixer_utilrrrr	r
rr�BaseFixrrrr�<module>rQs�����0������������������D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�&�&�&�90�90�90�90�90�
�"�90�90�90�90�90r

?>