Your IP : 3.145.43.92
�
c��f
� �z � d Z ddlmZ ddlmZ ddlmZ ddlmZmZm Z m
Z
mZmZ d� Z
G d� 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 ]?\ }}|j t j k r%|j d j dk r|| |dz fV � �@d S )N� �exceptr )� enumerate�typer �
except_clause�children�value)�nodes�i�ns �?/opt/alt/python311/lib64/python3.11/lib2to3/fixes/fix_except.py�find_exceptsr sh � � � ��%� � � &� &���1��6�T�'�'�'��z�!�}�"�h�.�.��%��!��*�o�%�%�%��&� &� c � � e Zd ZdZdZd� 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� |d D � � }d� |d D � � }t |� � D �]�\ }}t |j � � dk �r�|j dd� \ }} }
| � t dd� � � � � |
j t j k �rAt | � � � d� � � }|
�
� � }d
|_ |
� |� � |�
� � }|j }
t |
� � D ]!\ }}t |t j � � r n�"t! |
� � st# |
� � r,t% |t'