Your IP : 18.191.238.6


Current Path : /opt/alt/python38/lib64/python3.8/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/lib2to3/fixes/__pycache__/fix_except.cpython-38.opt-2.pyc

U

i�f
�@sbddlmZddlmZddlmZddlmZmZmZm	Z	m
Z
mZdd�ZGdd�dej
�Zd	S)
�)�pytree)�token)�
fixer_base)�Assign�Attr�Name�is_tuple�is_list�symsccsDt|�D]6\}}|jtjkr|jdjdkr|||dfVqdS)N��exceptr)�	enumerate�typer
�
except_clause�children�value)Znodes�i�n�r�=/opt/alt/python38/lib64/python3.8/lib2to3/fixes/fix_except.py�find_exceptssrc@seZdZdZdZdd�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)]) >
    cCsx|j}dd�|dD�}dd�|dD�}t|�D�]\}}t|j�dkr2|jdd�\}}	}
|	�tdd	d
��|
jtjk�r8t|�	�d	d
�}|
�
�}d|_|
�|�|�
�}|j}
t|
�D]\}}t
|tj�r�q�q�t|
�s�t|
�r�t|t|td���}n
t||�}t|
d|��D]}|�d
|��q|�||�q2|
jdkr2d	|
_q2dd�|jdd�D�||}t�|j|�S)NcSsg|]}|���qSr��clone)�.0rrrr�
<listcomp>2sz'FixExcept.transform.<locals>.<listcomp>�tailcSsg|]}|���qSrr)rZchrrrr4sZcleanup���as� )�prefix��argsrcSsg|]}|���qSrr)r�crrrr\s�)r
r�lenr�replacerrr�NAME�new_namerr!r
�
isinstancerZNoderr	rr�reversedZinsert_child)�selfZnodeZresultsr
rZtry_cleanuprZe_suite�EZcomma�NZnew_N�targetZsuite_stmtsrZstmtZassignZchildrrrr�	transform/s6


 zFixExcept.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNr0rrrrr$srN)r"rZpgen2rrZ
fixer_utilrrrrr	r
rZBaseFixrrrrr�<module>s
 

?>