ACC SHELL

Path : /usr/lib/python/lib2to3/fixes/
File Upload :
Current File : //usr/lib/python/lib2to3/fixes/fix_except.pyc

Ñò
sÄMc@sŠdZddklZddklZddklZddklZlZl	Z	l
Z
lZlZd„Z
deifd„ƒ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_listtsymsccsfx_t|ƒD]Q\}}|itijo2|ididjo|||dfVq^q
q
WdS(Niuexcepti(t	enumeratettypeRt
except_clausetchildrentvalue(tnodestitn((s./usr/lib/python2.6/lib2to3/fixes/fix_except.pytfind_exceptss

t	FixExceptcBseZdZd„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)]) >
    cCsO|i}g}|dD]}||iƒq~}g}|dD]}||iƒqC~}	x¤t|	ƒD]–\}
}t|
iƒdjot|
idd!\}}
}|
itdddƒƒ|iti	jot|i
ƒddƒ}|iƒ}d|_|i|ƒ|iƒ}|i}x2t|ƒD]$\}}t
|tiƒoPq/q/Wt|ƒp
t|ƒo"t|t|td	ƒƒƒ}nt||ƒ}x(t|| ƒD]}|id
|ƒq³W|i||ƒq|idjo
d|_qqlqlWg}|id D]}||iƒq~|	|}ti|i|ƒS(Nttailtcleanupiiuastprefixu uuargsii(RtcloneRtlenRtreplaceRR
RtNAMEtnew_nameRR	t
isinstanceRtNodeRRRRtreversedtinsert_child(tselftnodetresultsRt_[1]RRt_[2]tchttry_cleanupRte_suitetEtcommatNtnew_Nttargettsuite_stmtsRtstmttassigntchildt_[3]tcR((s./usr/lib/python2.6/lib2to3/fixes/fix_except.pyt	transform.s<	++
	
	
	"6(t__name__t
__module__tPATTERNR2(((s./usr/lib/python2.6/lib2to3/fixes/fix_except.pyR$sN(t__doc__tRtpgen2RRt
fixer_utilRRRRRRRtBaseFixR(((s./usr/lib/python2.6/lib2to3/fixes/fix_except.pyt<module>s.	

ACC SHELL 2018