U ifn @sVddlmZddlmZddlmZddlmZmZmZm Z m Z Gdddej Z dS))pytree)token) fixer_base)NameCallAttrArgListis_tuplec@seZdZdZdZddZdS)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c Csh|j}|d}|jtjkr2d}|||dSt|r^t|rX|jdjd}q:d|_d|krt |j t d|g}|j|_|S|d}t|rdd |jdd D}n d |_|g}d |krB|d } d | _|} |jtj ks|jd krt||} t| t dt| gg} t |jt dg| }|j|_|St j |j t dt||g|jdSdS)Nexcz+Python 3 does not support string exceptions valraisecSsg|] }|qS)clone).0crrDsz&FixRaise.transform..tbNonewith_traceback)prefix)symsrtyperSTRINGZcannot_convertr ZchildrenrrZNodeZ raise_stmtrNAMEvaluerrrZ simple_stmt) selfZnodeZresultsrr msgnewrargsreZwith_tbrrr transform&sB       zFixRaise.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr'rrrrr sr N) rrZpgen2rrZ fixer_utilrrrrr ZBaseFixr rrrrs