B ÍAÒ[wã@sJdZddlmZmZddlmZddlmZmZm Z Gdd„dej ƒZ dS)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@seZdZdZdZdd„ZdS)ÚFixRaiseTz5 raise_stmt< 'raise' exc=any [',' val=any] > c Csè|j}|d ¡}|jtjkr2d}| ||¡dSt|ƒrbx t|ƒrZ|jdjd ¡}qBsz&FixRaise.transform..éÿÿÿÿÚ)Úprefix)ÚsymsrÚtyperÚSTRINGZcannot_convertrÚchildrenrrÚNodeZ raise_stmtrr) ÚselfÚnodeÚresultsrr ÚmsgÚnewr ÚargsrrrÚ transform$s,     zFixRaise.transformN)Ú__name__Ú __module__Ú __qualname__Z BM_compatibleZPATTERNr"rrrrrsrN) Ú__doc__Zlib2to3rrZ lib2to3.pgen2rZlib2to3.fixer_utilrrrZBaseFixrrrrrÚs