%PDF- %PDF-
Direktori : /usr/local/lib/python2.7/lib2to3/fixes/ |
Current File : //usr/local/lib/python2.7/lib2to3/fixes/fix_raise.pyc |
ó Pęáac @ s{ d Z d d l m Z d d l m Z d d l m Z d d l m Z m Z m Z m Z m Z d e j f d YZ d S( s[ Fixer for 'raise E, V, T' raise -> raise raise E -> raise E raise E, V -> raise E(V) raise E, V, T -> raise E(V).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), V -> raise E(V) raise "foo", V, T -> warns about string exceptions 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. i ( t pytree( t token( t fixer_base( t Namet Callt Attrt ArgListt is_tuplet FixRaisec B s e Z e Z d Z d Z RS( sB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c C s | j } | d j } | j t j k rE d } | j | | d St | r x* t | r} | j d j d j } qT Wd | _ n d | k rÇ t j | j t d | g } | j | _ | S| d j } t | rg | j d d !D] } | j ^ qô } n d | _ | g } d | k rÖ| d j } d | _ | } | j t j k sm| j d k rt | | } n t | t d t | g g } t j | j t d g | } | j | _ | St j | j t d t | | g d | j Sd S( Nt excs+ Python 3 does not support string exceptionsi i u t valu raisei˙˙˙˙u t tbu Noneu with_tracebackt prefix( t symst clonet typeR t STRINGt cannot_convertR t childrenR R t Nodet raise_stmtR t NAMEt valueR R R t simple_stmt( t selft nodet resultsR R t msgt newR t ct argsR t et with_tb( ( s3 /usr/local/lib/python2.7/lib2to3/fixes/fix_raise.pyt transform&