Files
PowerToys/PythonHome/Lib/lib2to3/fixes/fix_except.pyc

39 lines
2.9 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@s<>dZddlmZddlmZddlmZddlmZmZm Z m
Z
m Z m Z d<00>Z dejfd<00><00>YZd S(
s<>Fixer for except statements with named exceptions.
The following cases will be converted:
- "except E, T:" where T is a name:
except E as T:
- "except E, T:" where T is not a name, tuple or list:
except E as t:
T = t
This is done because the target of an "except" clause must be a
name.
- "except E, T:" where T is a tuple or list literal:
except E as t:
T = t.args
i(tpytree(ttoken(t
fixer_base(tAssigntAttrtNametis_tupletis_listtsymsccsbx[t|<00>D]M\}}|jtjkr |jdjdkrZ|||dfVqZq q WdS(Niuexcepti(t enumeratettypeRt except_clausetchildrentvalue(tnodestitn((s!.\Lib\lib2to3\fixes\fix_except.pyt find_exceptsst FixExceptcBseZeZdZd<00>ZRS(s1
try_stmt< 'try' ':' (simple_stmt | suite)
cleanup=(except_clause ':' (simple_stmt | suite))+
tail=(['except' ':' (simple_stmt | suite)]
['else' ':' (simple_stmt | suite)]
['finally' ':' (simple_stmt | suite)]) >
cCs,|j}g|dD]}|j<00>^q}g|dD]}|j<00>^q7}x<>t|<00>D]<5D>\}} t|j<00>dkr\|jdd!\}
} } | jtddd<00><01>| jtj kr<>t|j
<00>dd<00>} | j<00>}d|_ | j| <00>| j<00>} | j}x0t |<00>D]"\}}t |tj<00>rPqqWt| <00>s[t| <00>r|t|t| td <00><00><00>}nt|| <00>}x(t|| <20>D]}| jd
|<00>q<>W| j||<00>q<>| j dkr<>d| _ q<>q\q\Wg|jd D]}|j<00>^q<>||}tj|j|<00>S( Nttailtcleanupiiuastprefixu uuargsii(RtcloneRtlenR treplaceRR
RtNAMEtnew_nameRR t
isinstanceRtNodeRRRRtreversedt insert_child(tselftnodetresultsRRRtcht try_cleanupR te_suitetEtcommatNtnew_Nttargett suite_stmtsRtstmttassigntchildtcR ((s!.\Lib\lib2to3\fixes\fix_except.pyt transform/s6 ##     !.(t__name__t
__module__tTruet BM_compatibletPATTERNR/(((s!.\Lib\lib2to3\fixes\fix_except.pyR$sN(t__doc__tRtpgen2RRt
fixer_utilRRRRRRRtBaseFixR(((s!.\Lib\lib2to3\fixes\fix_except.pyt<module>s .