AlkantarClanX12
Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/ |
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/fix_except.cpython-310.opt-2.pyc |
o 6��f � @ sd d dl mZ d dlmZ d dl mZ d dlmZmZmZm Z m Z mZ dd� ZG dd� dej �Zd S ) � )�pytree)�token)� fixer_base)�Assign�Attr�Name�is_tuple�is_list�symsc c sF � t | �D ]\}}|jtjkr |jd jdkr || |d fV qd S )N� �exceptr )� enumerate�typer � except_clause�children�value)Znodes�i�n� r �?/opt/alt/python310/lib64/python3.10/lib2to3/fixes/fix_except.py�find_excepts s ���r c @ s e Zd ZdZdZdd� 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 C sr | j }dd� |d D �}dd� |d D �}t|�D ]�\}}t|j�dkr�|jdd� \}} } | �tdd d �� | jtjkr�t| � � d d �}| � � }d|_| �|� |� � }|j} t| �D ]\}}t |tj�rh nq\t| �sqt| �r|t|t|td���}nt||�}t| d |� �D ]}|�d |� q�|�||� q| jdkr�d | _qdd� |jd d� D �| | }t�|j|�S )Nc S � g | ]}|� � �qS r ��clone)�.0r r r r � <listcomp>2 � z'FixExcept.transform.<locals>.<listcomp>�tailc S r r r )r Zchr r r r 4 r Zcleanup� � �as� )�prefix� �argsr c S r r r )r �cr r r r \ r � )r r �lenr �replacer r r �NAME�new_namer r# r � isinstancer ZNoder r r r �reversedZinsert_child)�selfZnodeZresultsr r Ztry_cleanupr Ze_suite�EZcomma�NZnew_N�targetZsuite_stmtsr ZstmtZassign�childr r r r � transform/ s: � � zFixExcept.transformN)�__name__� __module__�__qualname__Z BM_compatibleZPATTERNr3 r r r r r $ s r N)r$ r Zpgen2r r Z fixer_utilr r r r r r r ZBaseFixr r r r r �<module> s