%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/compiler/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/compiler/pyassem.pyo


Oac@sdZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
dfdYZdZdfd	YZ
d
ZdZdZd
ZdefdYZdZdfdYZdZdZdfdYZdfdYZejZdS(s/A flow graph representation for Python bytecodeiN(tmisc(tCO_OPTIMIZEDtCO_NEWLOCALSt
CO_VARARGStCO_VARKEYWORDSt	FlowGraphcBs}eZdZdZd
dZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZRS(cCs[t|_|_td|_tj|_|jj|j|jj|jdS(Ntexit(tBlocktcurrenttentryRRtSettblockstadd(tself((s,/usr/local/lib/python2.7/compiler/pyassem.pyt__init__s
cCsr|jre|jrWdGt|jGHdG|jjGHdG|jjGHdG|jjGHnt|GHn||_dS(Ntends    nexts    prevs   (t_debugRtreprtnexttprevtget_children(R
tblock((s,/usr/local/lib/python2.7/compiler/pyassem.pyt
startBlocks		cCs<|dkr|j}n|jj||j|dS(N(tNonetnewBlockRtaddNextR(R
R((s,/usr/local/lib/python2.7/compiler/pyassem.pyt	nextBlockscCst}|jj||S(N(RRR(R
tb((s,/usr/local/lib/python2.7/compiler/pyassem.pyR5s	cCs|j|jdS(N(RR(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pytstartExitBlock:sicCs
d|_dS(Ni(R(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyt
_enable_debug?scCs
d|_dS(Ni(R(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_disable_debugBscGse|jrdG|GHnt|dkrQt|dtrQ|jj|dn|jj|dS(Ns	ii(Rtlent
isinstanceRRt
addOutEdgetemit(R
tinst((s,/usr/local/lib/python2.7/compiler/pyassem.pyR"Es
	%cCst|j|j}|S(slReturn the blocks in reverse postorder

        i.e. each node appears before all of its successors
        (torder_blocksR	R(R
torder((s,/usr/local/lib/python2.7/compiler/pyassem.pytgetBlocksInOrderLscCs
|jjS(N(Rtelements(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyt	getBlocksTscCs|jS(s/Return nodes appropriate for use with dominator(R	(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pytgetRootWscCs4g}x'|jD]}|j|jqW|S(N(R(textendtgetContainedGraphs(R
tlR((s,/usr/local/lib/python2.7/compiler/pyassem.pyR+[sN(t__name__t
__module__RRRRRRRRRR"R&R(R)R+(((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs		
								csg}t|g}xh|r|j}|kr?qnj|x0|jD]"}|krY|j|qYqYWqWixD]}tr|jrnj|txd|jD]V}xMj|tj||j	r|j	d|k	r|j	d}qPqWqWqWfd}|}xv|j|j
||jrw|jd}qAn)||k	r|jr|j|nsPn|}qAW|S(s8Order blocks so that they are emitted in the right orderics>x7D]/}x&|D]}|krPqqW|SqWdS(N((Rtc(t
dominatorst	remaining(s,/usr/local/lib/python2.7/compiler/pyassem.pyt	find_nexts
(tsettpopRRtappendt	__debug__Rt
setdefaultt
get_followersRtdiscardthas_unconditional_transfer(tstart_blockt
exit_blockR%ttodoRR/R2((R0R1s,/usr/local/lib/python2.7/compiler/pyassem.pyR$bsH			





	

RcBszeZdZddZdZdZdZdZdZdZ	dZ
dZdZdZ
dZRS(itcCsPg|_t|_||_tj|_g|_g|_tjdt_dS(Ni(	tinstsR3toutEdgestlabelRt_counttbidRR(R
RA((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs				cCs,|jrd|j|jfSd|jSdS(Ns<block %s id=%d>s
<block id=%d>(RARC(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyt__repr__s	cCs2tt|j}d|j|jdj|fS(Ns<block %s %d:
%s>s
(tmaptstrR?RARCtjoin(R
R?((s,/usr/local/lib/python2.7/compiler/pyassem.pyt__str__scCs|d}|jj|dS(Ni(R?R5(R
R#top((s,/usr/local/lib/python2.7/compiler/pyassem.pyR"s
cCs|jS(N(R?(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pytgetInstructionsscCs|jj|dS(N(R@R(R
R((s,/usr/local/lib/python2.7/compiler/pyassem.pyR!scCs$|jj||jj|dS(N(RR5R(R
R((s,/usr/local/lib/python2.7/compiler/pyassem.pyRstRETURN_VALUEt
RAISE_VARARGSt
JUMP_ABSOLUTEtJUMP_FORWARDt
CONTINUE_LOOPcCs?y|jd\}}Wnttfk
r1dSX||jkS(sReturns True if there is an unconditional transfer to an other block
        at the end of this block. This means there is no risk for the bytecode
        executer to go past this block's bytecode.iN(R?t
IndexErrort
ValueErrort_uncond_transfer(R
RItarg((s,/usr/local/lib/python2.7/compiler/pyassem.pyR:s
cCst|j|jS(N(tlistR@R(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyRscCsNt|j}x8|jD]-}|dtjkr|j|dqqW|S(s:Get the whole list of followers, including the next block.ii(R3RR?tPyFlowGraphthasjrelR(R
t	followersR#((s,/usr/local/lib/python2.7/compiler/pyassem.pyR8s
cCsbg}xU|jD]J}t|dkr.qn|d}t|dr|j|jqqW|S(sReturn all graphs contained within this block.

        For example, a MAKE_FUNCTION block will contain a reference to
        the graph for the function body.
        itgraph(R?RthasattrR5RX(R
t	containedR#RI((s,/usr/local/lib/python2.7/compiler/pyassem.pyR+s
(RKRLRMRNRO(R-R.RBRRDRHR"RJR!RRRR:RR8R+(((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs								
		
tRAWtFLATtCONVtDONERUcBsAeZejZddddZdZdZdZdZ	dZ
dZddZd	Z
d
ZeZx%ejD]ZejejeqWeZx%ejD]ZejejeqWdZdZd
ZiZdZdZeZeZdZdZeZ eZ!eZ"eZ#eZ$eZ%eZ&eZ'eZ(eZ)dZ*e*Z+e*Z,dZ-e.ej/Z0dZ1xDe2j3D]3\Z4Z5e4d dkre4dZe5ee<qqW[4[5[dZ6iZ7x.e8e9ejD]Z:e:e7eje:<qW[:dZ;dZ<RS(icCs|j||_||_d|_||_t||_||_|r\t	t
B|_n	d|_g|_g|_
g|_g|_g|_t|pg|_xOtt|jD]8}|j|}t|tr|j|j|<qqWt|_dS(Ni(t
super_inittnametfilenameRt	docstringtargstgetArgCounttargcounttklassRRtflagstconststnamestfreevarstcellvarstclosureRTtvarnamestrangeRR tTupleArgtgetNameR[tstage(R
R`RaRct	optimizedRftitvar((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs*
											
cCs
||_dS(N(Rb(R
tdoc((s,/usr/local/lib/python2.7/compiler/pyassem.pytsetDocstringscCs3|j|B|_|tkr/|jd|_ndS(Ni(RgRRe(R
tflag((s,/usr/local/lib/python2.7/compiler/pyassem.pytsetFlag"scCs|j|@rdSdS(Ni(Rg(R
Rw((s,/usr/local/lib/python2.7/compiler/pyassem.pyt	checkFlag's
cCst||_dS(N(RTRj(R
Ri((s,/usr/local/lib/python2.7/compiler/pyassem.pytsetFreeVars+scCs
||_dS(N(Rk(R
Ri((s,/usr/local/lib/python2.7/compiler/pyassem.pytsetCellVars.scCs2|j|j|j|j|jS(sGet a Python code object(tcomputeStackDepthtflattenGraphtconvertArgstmakeByteCodet
newCodeObject(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pytgetCode1s




cCs|rtj}|t_nd}x~|jD]s}|d}|dkrKHnt|dkr{dGd|G|GH|d}q+dGd|G|G|dGH|d}q+W|r|t_ndS(Nit
SET_LINENOis	s%3di(tsyststdoutR?R(R
tiotsavetpctttopname((s,/usr/local/lib/python2.7/compiler/pyassem.pytdump=s	

cspid}x*jD]}t|j|<qWifdjd_dS(sCompute the max stack depth.

        Approach is to compute the stack effect of each basic block.
        Then find the path through the code with the largest total
        effect.
        cs|kr|Sd|<||}|j}|r`tg|D]}||^qDS|jdksj|S|SdS(NiR(RtmaxRAR(RtdtchildrenR/(tdeptht	max_depthtseenR
(s,/usr/local/lib/python2.7/compiler/pyassem.pyR]s
&iN(RR(t	findDepthRJR	t	stacksize(R
RR((RRRR
s,/usr/local/lib/python2.7/compiler/pyassem.pyR|OscCsg|_}d}i}i}x|jD]z}|||<x]|jD]O}|j|t|dkr{|d}qI|ddkrI|d}qIqIW|||<q,Wd}xtt|D]}||}t|dkr|d}n|ddkr|d}n|d}||jkrS|d}	||	|}
||
f||<q||jkr|||df||<qqWt|_	dS(s-Arrange the blocks in order and resolve jumpsiiRiN(
R?R&RJR5RRnRVthasjabsR\Rq(R
R?RtbeginRRR#RsRtopargtoffset((s,/usr/local/lib/python2.7/compiler/pyassem.pyR}ms8








cCs|jjd|j|jxtt|jD]n}|j|}t|dkr6|\}}|jj|d}|r||||f|j|<qq6q6Wt
|_dS(s0Convert arguments from symbolic to concrete formiiN(RhtinsertRbt
sort_cellvarsRnRR?t_converterstgetRR]Rq(R
RsRRRtconv((s,/usr/local/lib/python2.7/compiler/pyassem.pyR~s

&cCsi}x|jD]}d||<qWg|jD]}||kr.|^q.|_x|jD]
}||=qYW|j|j|_|j|j|_dS(sHSort cellvars in the order of varnames and prune from freevars.
        iN(RkRmtkeysRjRl(R
tcellsR`((s,/usr/local/lib/python2.7/compiler/pyassem.pyRscCspt|}xDtt|D]0}|t||kr|||kr|SqWt|}|j||S(sReturn index of name in list, appending if necessary

        This routine uses a list instead of a dictionary, because a
        dictionary can't store two different keys if the keys have the
        same value but different types, e.g. 2 and 2L.  The compiler
        must treat these two separately, so it does an explicit type
        comparison before comparing the values.
        (ttypeRnRR5(R
R`RTRRsR((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_lookupNames	&
cCs1t|dr|j}n|j||jS(NR(RYRRRh(R
RS((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_convert_LOAD_CONSTscCs&|j||j|j||jS(N(RRiRm(R
RS((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_convert_LOAD_FASTscCs8|jdkr%|j||jn|j||jS(N(RfRRRmRi(R
RS((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_convert_LOAD_NAMEscCs8|jdkr%|j||jn|j||jS(N(RfRRRmRi(R
RS((s,/usr/local/lib/python2.7/compiler/pyassem.pyt
_convert_NAMEscCs9|j||j|j||j|j||jS(N(RRiRmRl(R
RS((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_convert_DEREFscCs&|j||j|j||jS(N(RRmRl(R
RS((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_convert_LOAD_CLOSUREscCs|jj|S(N(t_cmptindex(R
RS((s,/usr/local/lib/python2.7/compiler/pyassem.pyt_convert_COMPARE_OPsi	t	_convert_cCst|_}x|jD]}|d}t|dkrS|j|j|q|d}|dkr||j|qnt|\}}y|j|j|||Wqtk
r|G|GH|j|G|G|GHqXqWt	|_
dS(NiiR(t
LineAddrTabletlnotabR?RtaddCodetopnumtnextLinettwobyteRQR^Rq(R
RRRRthitlo((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs"



	cCs|jt@dkrd}nt|j}|j}|jt@rN|d}ntj|||j|j|j	j
|jt|j
t|j|j|j|j	j|j	jt|jt|jS(Nii(RgRRRmReRttypestCodeTypeRRRt	getConststtupleRiRaR`t	firstlinetgetTableRjRk(R
tnlocalsRe((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs		

cCsOg}x<|jD]1}t|tr4|j}n|j|qWt|S(sReturn a tuple for the const slot of the code object

        Must convert references to code (MAKE_FUNCTION) to code
        objects recursively.
        (RhR RURR5R(R
R,telt((s,/usr/local/lib/python2.7/compiler/pyassem.pyR"s(N(=R-R.RRR_RRvRxRyRzR{RRR|R}R3RVtdisRsRRRR~RRRRRt_convert_STORE_FASTt_convert_DELETE_FASTRRt_convert_STORE_NAMEt_convert_DELETE_NAMEt_convert_IMPORT_NAMEt_convert_IMPORT_FROMt_convert_STORE_ATTRt_convert_LOAD_ATTRt_convert_DELETE_ATTRt_convert_LOAD_GLOBALt_convert_STORE_GLOBALt_convert_DELETE_GLOBALRt_convert_LOAD_DEREFt_convert_STORE_DEREFRRTtcmp_opRRtlocalstitemsR`tobjRRRnRtnumRR(((s,/usr/local/lib/python2.7/compiler/pyassem.pyRUsn									!				
								
			cCs|d dkrdSdS(NitJUMPi((R((s,/usr/local/lib/python2.7/compiler/pyassem.pytisJump/sRocBs)eZdZdZdZdZRS(s:Helper for marking func defs with nested tuples in arglistcCs||_||_dS(N(tcountRi(R
RRi((s,/usr/local/lib/python2.7/compiler/pyassem.pyR5s	cCsd|j|jfS(NsTupleArg(%s, %s)(RRi(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyRD8scCsd|jS(Ns.%d(R(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyRp:s(R-R.t__doc__RRDRp(((s,/usr/local/lib/python2.7/compiler/pyassem.pyRo3s		cCs^t|}|rZxE|D]:}t|trttj|j}||}qqWn|S(N(RR RoRtflattenRi(RcReRStnumNames((s,/usr/local/lib/python2.7/compiler/pyassem.pyRd=s
cCs
t|dS(s/Convert an int argument into high and low bytesi(tdivmod(tval((s,/usr/local/lib/python2.7/compiler/pyassem.pyRFsRcBs;eZdZdZdZdZdZdZRS(s(lnotab

    This class builds the lnotab, which is documented in compile.c.
    Here's a brief recap:

    For each SET_LINENO instruction after the first one, two bytes are
    added to lnotab.  (In some cases, multiple two-byte entries are
    added.)  The first byte is the distance in bytes between the
    instruction for the last SET_LINENO and the current SET_LINENO.
    The second byte is offset in line numbers.  If either offset is
    greater than 255, multiple two-byte entries are added -- see
    compile.c for the delicate details.
    cCs:g|_d|_d|_d|_d|_g|_dS(Ni(tcodet
codeOffsetRtlastlinetlastoffR(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyRZs					cGsAx$|D]}|jjt|qW|jt||_dS(N(RR5tchrRR(R
RcRS((s,/usr/local/lib/python2.7/compiler/pyassem.pyRbs
cCs|jdkr$||_||_n|j|j}||j}|dkr|jj}x.|dkr|d|d|d8}q\Wx4|dkr|||d|d8}d}qW|dks|dkr||||n||_|j|_ndS(Nii(RRRRRR5(R
tlinenotaddrtlinetpush((s,/usr/local/lib/python2.7/compiler/pyassem.pyRgs*	








	cCsdj|jS(NR>(RGR(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyRscCsdjtt|jS(NR>(RGRERR(R
((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs(R-R.RRRRRR(((s,/usr/local/lib/python2.7/compiler/pyassem.pyRKs
			 	tStackDepthTrackercBseZddZi&dd6dd6dd6dd6dd	6dd
6dd6dd6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd!6dd"6dd#6dd$6dd%6dd&6dd'6d(d)6d(d*6dd+6dd,6Zd;d<gZd/Zd0Zd1Zd2Zd3Z	d4Z
d5Zd6Zd7Z
d8Zd9Zd:ZRS(=icCsd}d}x|D]}|d}|r0|Gn|jj|d}|dk	r^||}nxA|jD]6\}}	|t| |krh|	}||}PqhqhW|dkrt||d}
|
dk	r||
|d}qn||kr|}n|r|G|GHqqW|S(Nii(teffectRRtpatternsRtgetattr(R
R?tdebugRtmaxDepthRsRtdeltatpatt	pat_deltatmeth((s,/usr/local/lib/python2.7/compiler/pyassem.pyRs.



	itPOP_TOPitDUP_TOPtLIST_APPENDtSET_ADDitMAP_ADDsSLICE+1sSLICE+2sSLICE+3s
STORE_SLICE+0s
STORE_SLICE+1s
STORE_SLICE+2is
STORE_SLICE+3sDELETE_SLICE+0sDELETE_SLICE+1sDELETE_SLICE+2sDELETE_SLICE+3tSTORE_SUBSCRt
DELETE_SUBSCRt
PRINT_ITEMRKtYIELD_VALUEt	EXEC_STMTtBUILD_CLASSt
STORE_NAMEt
STORE_ATTRtDELETE_ATTRtSTORE_GLOBALt	BUILD_MAPt
COMPARE_OPt
STORE_FASTtIMPORT_STARtIMPORT_NAMEtIMPORT_FROMt	LOAD_ATTRitSETUP_EXCEPTt
SETUP_FINALLYtFOR_ITERtWITH_CLEANUPtBINARY_tLOAD_cCs|dS(Ni((R
R((s,/usr/local/lib/python2.7/compiler/pyassem.pytUNPACK_SEQUENCEscCs	|dS(Ni((R
R((s,/usr/local/lib/python2.7/compiler/pyassem.pytBUILD_TUPLEscCs	|dS(Ni((R
R((s,/usr/local/lib/python2.7/compiler/pyassem.pyt
BUILD_LISTscCs	|dS(Ni((R
R((s,/usr/local/lib/python2.7/compiler/pyassem.pyt	BUILD_SETscCs"t|d\}}||dS(Nii(R(R
targcRR((s,/usr/local/lib/python2.7/compiler/pyassem.pyt
CALL_FUNCTIONscCs|j|dS(Ni(R
(R
R	((s,/usr/local/lib/python2.7/compiler/pyassem.pytCALL_FUNCTION_VARscCs|j|dS(Ni(R
(R
R	((s,/usr/local/lib/python2.7/compiler/pyassem.pytCALL_FUNCTION_KWscCs|j|dS(Ni(R
(R
R	((s,/usr/local/lib/python2.7/compiler/pyassem.pytCALL_FUNCTION_VAR_KWscCs|S(N((R
R	((s,/usr/local/lib/python2.7/compiler/pyassem.pyt
MAKE_FUNCTIONscCs|S(N((R
R	((s,/usr/local/lib/python2.7/compiler/pyassem.pytMAKE_CLOSUREscCs$|dkrdS|dkr dSdS(Niiii((R
R	((s,/usr/local/lib/python2.7/compiler/pyassem.pytBUILD_SLICEscCs|S(N((R
R	((s,/usr/local/lib/python2.7/compiler/pyassem.pytDUP_TOPXs(Ri(Ri(R-R.RRRRRRRR
RRR
RRRR(((s,/usr/local/lib/python2.7/compiler/pyassem.pyRsl
												(RRRRtcompilerRtcompiler.constsRRRRRR$RR[R\R]R^RURRoRdRRRR(((s,/usr/local/lib/python2.7/compiler/pyassem.pyt<module>s*"W	CT2	
			Bn

Zerion Mini Shell 1.0