관리-도구
편집 파일: fix_raise.cpython-37.pyc
B �A�[w � @ sJ d Z ddlmZmZ ddlmZ ddlmZmZm Z G dd� dej �ZdS )a� Fixer for 'raise E, V' From Armin Ronacher's ``python-modernize``. raise -> raise raise E -> raise E raise E, V -> raise E(V) raise (((E, E'), E''), E'''), V -> raise E(V) CAVEATS: 1) "raise E, V" will be incorrectly translated if V is an exception instance. The correct Python 3 idiom is raise E from V but since we can't detect instance-hood by syntax alone and since any client code would have to be changed as well, we don't automate this. � )�pytree� fixer_base)�token)�Name�Call�is_tuplec @ s e Zd ZdZdZdd� ZdS )�FixRaiseTz5 raise_stmt< 'raise' exc=any [',' val=any] > c C s� | j }|d �� }|jtjkr2d}| �||� d S t|�rbx t|�rZ|jd jd �� }q<W d|_d|kr�t � |jtd�|g�}|j|_|S |d �� }t|�r�dd � |jdd � D �}nd|_|g}t j |jtd�t ||�g|jd�S ) N�excz+Python 3 does not support string exceptions� r � �val�raisec S s g | ]}|� � �qS � )�clone)�.0�cr r �L/opt/alt/python37/lib/python3.7/site-packages/libfuturize/fixes/fix_raise.py� <listcomp>B s z&FixRaise.transform.<locals>.<listcomp>���� )�prefix)�symsr �typer �STRINGZcannot_convertr �childrenr r �NodeZ raise_stmtr r ) �self�node�resultsr r �msg�newr �argsr r r � transform$ s, zFixRaise.transformN)�__name__� __module__�__qualname__Z BM_compatibleZPATTERNr"