CasperSecurity

Current Path : /lib/python3.10/lib2to3/fixes/__pycache__/
Upload File :
Current File : //lib/python3.10/lib2to3/fixes/__pycache__/fix_except.cpython-310.pyc

o

��bc
�@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�symsccsF�t|�D]\}}|jtjkr |jdjdkr |||dfVqdS)N��exceptr)�	enumerate�typer
�
except_clause�children�value)�nodes�i�n�r�//usr/lib/python3.10/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)]) >
    cCsr|j}dd�|dD�}dd�|dD�}t|�D]�\}}t|j�dkr�|jdd�\}}	}
|	�tdd	d
��|
jtjkr�t|�	�d	d
�}|
�
�}d|_|
�|�|�
�}|j}
t|
�D]\}}t
|tj�rhnq\t|
�sqt|
�r|t|t|td���}nt||�}t|
d|��D]}|�d
|�q�|�||�q|
jdkr�d	|
_qdd�|jdd�D�||}t�|j|�S)NcS�g|]}|���qSr��clone)�.0rrrr�
<listcomp>2�z'FixExcept.transform.<locals>.<listcomp>�tailcSrrr)r�chrrrr4r�cleanup���as� )�prefix��argsrcSrrr)r�crrrr\r�)r
r�lenr�replacerrr�NAME�new_namerr&r
�
isinstancer�Noderr	rr�reversed�insert_child)�self�node�resultsr
r�try_cleanupr�e_suite�E�comma�N�new_N�target�suite_stmtsr�stmt�assign�childrrrr�	transform/s:
�

� zFixExcept.transformN)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNrArrrrr$srN)�__doc__r'r�pgen2rr�
fixer_utilrrrrr	r
r�BaseFixrrrrr�<module>s 
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY