Viewing File: /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_throw.cpython-35.pyc



¯ÕYf.ã@s{dZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZGdd„dejƒZ
dS)	zÖFixer for generator.throw(E, V, T).

g.throw(E)       -> g.throw(E)
g.throw(E, V)    -> g.throw(E(V))
g.throw(E, V, T) -> g.throw(E(V).with_traceback(T))

g.throw("foo"[, V[, T]]) will warn about string exceptions.é)Úpytree)Útoken)Ú
fixer_base)ÚNameÚCallÚArgListÚAttrÚis_tuplec@s(eZdZdZdZdd„ZdS)ÚFixThrowTzÉ
    power< any trailer< '.' 'throw' >
           trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' >
    >
    |
    power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > >
    cCsG|j}|djƒ}|jtjkr?|j|dƒdS|jdƒ}|dkr^dS|jƒ}t|ƒr™dd„|jdd…Dƒ}nd|_	|g}|d}d	|kr-|d	jƒ}d|_	t
||ƒ}	t|	td
ƒƒt
|gƒg}
|jtj|j|
ƒƒn|jt
||ƒƒdS)NÚexcz+Python 3 does not support string exceptionsÚvalcSsg|]}|jƒ‘qS©)Úclone)Ú.0Úcr
r
ú</opt/alt/python35/lib64/python3.5/lib2to3/fixes/fix_throw.pyú
<listcomp>)s	z&FixThrow.transform.<locals>.<listcomp>éÚÚargsÚtbÚwith_tracebackéÿÿÿÿ)ÚsymsrÚtyperÚSTRINGZcannot_convertÚgetr	ZchildrenÚprefixrrrrÚreplacerZNodeZpower)ÚselfZnodeZresultsrrrrZ
throw_argsrÚeZwith_tbr
r
rÚ	transforms*	#		
	%zFixThrow.transformN)Ú__name__Ú
__module__Ú__qualname__Z
BM_compatibleZPATTERNr!r
r
r
rr
sr
N)Ú__doc__rrZpgen2rrZ
fixer_utilrrrrr	ZBaseFixr
r
r
r
rÚ<module>s
(
Back to Directory File Manager