| x d Z ddlmZmZ ddlmZ ddlmZmZm Z m
Z
mZmZ ddl
mZ G d dej ZdS ) a Fixer for 'raise E, V'
From Armin Ronacher's ``python-modernize``.
raise -> raise
raise E -> raise E
raise E, 5 -> raise E(5)
raise E, 5, T -> raise E(5).with_traceback(T)
raise E, None, T -> raise E.with_traceback(T)
raise (((E, E'), E''), E'''), 5 -> raise E(5)
raise "foo", V, T -> warns about string exceptions
raise E, (V1, V2) -> raise E(V1, V2)
raise E, (V1, V2), T -> raise E(V1, V2).with_traceback(T)
CAVEATS:
1) "raise E, V, T" cannot be translated safely in general. If V
is not a tuple or a (number, string, None) literal, then:
raise E, V, T -> from future.utils import raise_
raise_(E, V, T)
)pytree
fixer_base)token)NameCallis_tupleCommaAttrArgList)touch_import_topc e Zd ZdZdZd ZdS )FixRaiseTzB
raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] >
c | j }|d }|j t j k rd}| || d S t
| rOt
| r9|j d j d }t
| 9d|_ d|v r|d }nd }d|v r|d }t
| r*d |j dd D }t || }n|j t j
t j fv rd
|_ t ||g }n|j t j k r|j dk rnbt dd
| d
|_ |t |g}||t |gz
}t t d
||j S |7d
|_ t! |t d t# |g gz } n|g} t% j |j t d g| z |j S )Nexcz+Python 3 does not support string exceptions r tbvalc 6 g | ]}| S )clone).0cs m/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/libfuturize/fixes/fix_raise.py