Your IP : 18.119.142.113


Current Path : /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_except.cpython-35.opt-2.pyc



���]
�@s�ddlmZddlmZddlmZddlmZmZmZm	Z	m
Z
mZdd�ZGdd�dej
�Zd	S)
�)�pytree)�token)�
fixer_base)�Assign�Attr�Name�is_tuple�is_list�symsccs\xUt|�D]G\}}|jtjkr
|jdjdkr
|||dfVq
WdS)N��exceptr)�	enumerate�typer
�
except_clause�children�value)Znodes�i�n�r�//opt/alt/python35/lib64/python3.5/fix_except.py�find_exceptssrc@s(eZdZdZdZdd�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)]) >
    cCs|j}dd�|dD�}dd�|dD�}x�t|�D]�\}}t|j�dkrD|jdd�\}}	}
|	jtdd	d
��|
jtjkr�t|j	�d	d
�}|
j
�}d|_|
j|�|j
�}|j}
x-t|
�D]\}}t
|tj�rPqWt|
�sCt|
�rdt|t|td���}nt||�}x.t|
d|��D]}|jd
|�q�W|j||�qD|
jdkrDd
|
_qDWdd�|jdd�D�||}tj|j|�S)NcSsg|]}|j��qSr)�clone)�.0rrrr�
<listcomp>2s	z'FixExcept.transform.<locals>.<listcomp>�tailcSsg|]}|j��qSr)r)rZchrrrr4s	�cleanup���as�prefix� ��argsrcSsg|]}|j��qSr)r)r�crrrr\s	�)r
r�lenr�replacerrr�NAME�new_namerr r
�
isinstancerZNoderr	rr�reversedZinsert_child)�selfZnode�resultsr
rZtry_cleanuprZe_suite�EZcomma�NZnew_N�targetZsuite_stmtsrZstmtZassignZchildrrrr�	transform/s6		
	!
(zFixExcept.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNr1rrrrr$srN)r"rZpgen2rrZ
fixer_utilrrrrr	r
rZBaseFixrrrrr�<module>s
.

?>