ok

Mini Shell

Direktori : /lib64/python3.6/lib2to3/fixes/__pycache__/
Upload File :
Current File : //lib64/python3.6/lib2to3/fixes/__pycache__/fix_except.cpython-36.pyc

3


 \
�@sfdZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZmZdd�Z
Gdd	�d	ej�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�symsccsHxBt|�D]6\}}|jtjkr
|jdjdkr
|||dfVq
WdS)N��exceptr)�	enumerate�typer
�
except_clause�children�value)Znodes�i�n�r�0/usr/lib64/python3.6/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)]) >
    cCs�|j}dd�|dD�}dd�|dD�}�x*t|�D�]\}}t|j�dkr6|jdd�\}}	}
|	jtdd	d
��|
jtjk�rDt|j	�d	d
�}|
j
�}d|_|
j|�|j
�}|j}
x"t|
�D]\}}t
|tj�r�Pq�Wt|
�s�t|
��rt|t|td���}n
t||�}x&t|
d|��D]}|jd
|��q W|j||�q6|
jdkr6d	|
_q6Wdd�|jdd�D�||}tj|j|�S)NcSsg|]}|j��qSr)�clone)�.0rrrr�
<listcomp>2sz'FixExcept.transform.<locals>.<listcomp>�tailcSsg|]}|j��qSr)r)rZchrrrr4sZcleanup���as� )�prefix��argsrcSsg|]}|j��qSr)r)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_compatibleZPATTERNr/rrrrr$srN)�__doc__r!rZpgen2rrZ
fixer_utilrrrrr	r
rZBaseFixrrrrr�<module>s 

Zerion Mini Shell 1.0