��Qc@s�ddlZddlZddlZddlZddlZddlmZddlmZm Z m
Z
mZddlmZm
Z
mZmZddlmZmZmZmZmZddlmZmZmZmZmZmZmZmZmZddlm Z yej!dZ"Wne#k
r2d Z"nXid
ddf6dd df6ddd f6d
d d f6Z$d Z%dZ&dZ'dZ(dd�Z)e*e*d�Z+dfd��YZ,de,fd��YZ-de,fd��YZ.de,fd��YZ/dfd��YZ0d�Z1dfd��YZ2d fd!��YZ3d"e3e2fd#��YZ4d$e3e2fd%��YZ5d&e3e2fd'��YZ6d(fd)��YZ7d*e3e7e2fd+��YZ8d,e3e7e2fd-��YZ9d.fd/��YZ:d0e3e:e2fd1��YZ;d2�Z<d3�Z=d4fd5��YZ>d6fd7��YZ?d8e?fd9��YZ@d:e?fd;��YZAd<e?fd=��YZBd>e?fd?��YZCie@ejD6eAejE6eBejF6eCejG6ZHd@�ZIeJdAkr�ejKd D]ZLe)eL�q�WndS(Bi�N(tStringIO(tasttparsetwalktsyntax(tpyassemtmisctfuturetsymbols(tSC_LOCALtSC_GLOBAL_IMPLICITtSC_GLOBAL_EXPLICITtSC_FREEtSC_CELL( t
CO_VARARGStCO_VARKEYWORDStCO_NEWLOCALSt CO_NESTEDtCO_GENERATORtCO_FUTURE_DIVISIONtCO_FUTURE_ABSIMPORTtCO_FUTURE_WITH_STATEMENTtCO_FUTURE_PRINT_FUNCTION(tTupleArgiit
CALL_FUNCTIONtCALL_FUNCTION_VARtCALL_FUNCTION_KWtCALL_FUNCTION_VAR_KWiiicCs�t|d�}|j�}|j�t||�}y|j|�Wntk
r[�n+Xt|dd�}|j|�|j�dS(NtUtctwb(topentreadtclosetModuletcompiletSyntaxErrortdump(tfilenametdisplaytftbuftmod((s(/sys/lib/python2.7/compiler/pycodegen.pytcompileFile%s
cCs�|dk s|dk r$td�n|dkrBt||�}nH|dkr`t||�}n*|dkr~t||�}ntd��|j�|jS(s*Replacement for builtin compile() functionsnot implemented yettsingletexectevals6compile() 3rd arg must be 'exec' or 'eval' or 'single'N(tNonetRuntimeErrortInteractiveR"t
Expressiont
ValueErrorR#tcode(tsourceR&tmodetflagstdont_inherittgen((s(/sys/lib/python2.7/compiler/pycodegen.pyR#3s
tAbstractCompileModecBs2eZdZd�Zd�Zd�Zd�ZRS(cCs||_||_d|_dS(N(R5R&R/R4(tselfR5R&((s(/sys/lib/python2.7/compiler/pycodegen.pyt__init__Hs cCs9t|j|j�}tj|j|�tj|�|S(N(RR5R6Rtset_filenameR&Rtcheck(R;ttree((s(/sys/lib/python2.7/compiler/pycodegen.pyt _get_treeMs
cCsdS(N((R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR#SscCs|jS(N(R4(R;((s(/sys/lib/python2.7/compiler/pycodegen.pytgetCodeVsN(t__name__t
__module__R/R6R<R@R#RA(((s(/sys/lib/python2.7/compiler/pycodegen.pyR:Ds
R2cBseZdZd�ZRS(R.cCs+|j�}t|�}|j�|_dS(N(R@tExpressionCodeGeneratorRAR4(R;R?R9((s(/sys/lib/python2.7/compiler/pycodegen.pyR#]s(RBRCR6R#(((s(/sys/lib/python2.7/compiler/pycodegen.pyR2YsR1cBseZdZd�ZRS(R,cCs+|j�}t|�}|j�|_dS(N(R@tInteractiveCodeGeneratorRAR4(R;R?R9((s(/sys/lib/python2.7/compiler/pycodegen.pyR#fs(RBRCR6R#(((s(/sys/lib/python2.7/compiler/pycodegen.pyR1bsR"cBs8eZdZdd�Zd�Zej�Zd�ZRS(R-icCsN|j�}t|�}|r;ddl}|j|�GHn|j�|_dS(Ni�(R@tModuleCodeGeneratortpprintRAR4(R;R'R?R9RG((s(/sys/lib/python2.7/compiler/pycodegen.pyR#oscCs*|j|j��tj|j|�dS(N(twritetgetPycHeadertmarshalR%R4(R;R(((s(/sys/lib/python2.7/compiler/pycodegen.pyR%wscCs2tjj|j�}tjd|�}|j|S(Ns<i(tostpathtgetmtimeR&tstructtpacktMAGIC(R;tmtime((s(/sys/lib/python2.7/compiler/pycodegen.pyRI}s( RBRCR6R#R%timpt get_magicRPRI(((s(/sys/lib/python2.7/compiler/pycodegen.pyR"ks
tLocalNameFindercBskeZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�ZRS(sFind local names in scopecCsCtj�|_tj�|_x|D]}|jj|�q%WdS(N(RtSettnamestglobalstadd(R;RVtname((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�s
cCsFx<|jj�D]+}|jj|�r|jj|�qqW|jS(N(RWtelementsRVthas_elttremove(R;telt((s(/sys/lib/python2.7/compiler/pycodegen.pyt getLocals�scCsdS(N((R;tnode((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitDict�scCs(x!|jD]}|jj|�q
WdS(N(RVRWRX(R;R_RY((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitGlobal�scCs|jj|j�dS(N(RVRXRY(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitFunction�scCsdS(N((R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitLambda�scCs4x-|jD]"\}}|jj|p(|�q
WdS(N(RVRX(R;R_RYtalias((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitImport�scCs4x-|jD]"\}}|jj|p(|�q
WdS(N(RVRX(R;R_RYRd((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitFrom�scCs|jj|j�dS(N(RVRXRY(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitClass�scCs|jj|j�dS(N(RVRXRY(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAssName�s((
RBRCt__doc__R<R^R`RaRbRcReRfRgRh(((s(/sys/lib/python2.7/compiler/pycodegen.pyRT�s cCs&t|tj�r"|js"dSndS(Nii(t
isinstanceRtConsttvalue(R_((s(/sys/lib/python2.7/compiler/pycodegen.pytis_constant_false�s t
CodeGeneratorcBsUeZdZdZd�Zd�Zd�Zd�Zd�Z d�Z
d�Zd�Zd�Z
d �Zd
�Zd�Zd�Zd
�Zd�Zd�Zed�ZeZd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d �Z*d!�Z+d"�Z,d#�Z-d$�Z.d%�Z/d&�Z0d'�Z1d(�Z2d)�Z3d*�Z4d+�Z5d,�Z6d-�Z7d.�Z8dZ9d/�Z:d0�Z;d1�Z<d2�Z=d3�Z>d4�Z?d5�Z@d6�ZAd7�ZBd8�ZCd9�ZDd:�ZEd;�ZFd<�ZGd=d>�ZHeId?krveHZJeHZKnd@�ZJdA�ZKdB�ZLidCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6ZMd[�ZNd\�ZOd]�ZPd^�ZQd_�ZRd`�ZSdda�ZTdb�ZUdc�ZVdd�ZWd�de�ZXd�df�ZYdg�ZZdh�Z[di�Z\dj�Z]dk�Z^dl�Z_dm�Z`dn�Zado�Zbdp�Zcdq�Zddr�Zeds�Zfdt�Zgdu�Zhdv�Zidw�Zjdx�Zkdy�Zldz�Zmd{�Znd|�Zod}�Zpd~�Zqd�Zrd��Zsd��ZtRS(�s�Defines basic code generator for Python bytecode
This class is an abstract base class. Concrete subclasses must
define an __init__() that defines self.graph and then calls the
__init__() defined in this class.
The concrete class must also define the class attributes
NameFinder, FunctionGen, and ClassGen. These attributes can be
defined in the initClass() method, which is a hook for
initializing these methods after all the classes have been
defined.
icCs|jdkr(|j�d|j_n|j�tj�|_tj�|_d|_ |j
�d|_|j�j
}x�|D]�}|dkr�|jjt�d|_q�|dkr�|jjt�q�|dkr�jjt�q�|dkr�|jjt�q�q�WdS(Nit
BINARY_DIVIDEtdivisiontBINARY_TRUE_DIVIDEtabsolute_importtwith_statementtprint_function(t_CodeGenerator__initializedR/t initClasst __class__t
checkClassRtStacktlocalstsetupstlast_linenot_setupGraphDelegationt_div_opt
get_moduletfuturestgraphtsetFlagRRRR(R;R�tfeature((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�s(
cCsdS(s)This method is called once for each classN((R;((s(/sys/lib/python2.7/compiler/pycodegen.pyRv�scCs�yXt|d�st�t|d�s-t�t|d�sBt�t|d�sWt�Wn,tk
r�}d|jj}t|�nXdS(s*Verify that class is constructed correctlyR�t
NameFindertFunctionGentClassGensBad class construction for %sN(thasattrtAssertionErrortgetattrRwRB(R;tmsgtintro((s(/sys/lib/python2.7/compiler/pycodegen.pyRx�scCsO|jj|_|jj|_|jj|_|jj|_|jj|_dS(N(R�temittnewBlockt
startBlockt nextBlocktsetDocstring(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR}�s
cCs
|jj�S(sReturn a code object(R�RA(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyRA�scCs*|jdk r"tj||j�S|SdS(N(t
class_nameR/Rtmangle(R;RY((s(/sys/lib/python2.7/compiler/pycodegen.pyR��scCs tj�}t||�|jS(N(Rt
SymbolVisitorRtscopes(R;R?ts((s(/sys/lib/python2.7/compiler/pycodegen.pytparseSymbolss
cCs
td�dS(Ns#should be implemented by subclasses(R0(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyRscCs|jj�j|�S(N(RzttopR[(R;RY((s(/sys/lib/python2.7/compiler/pycodegen.pytisLocalName
scCs|jd|�dS(NtSTORE(t_nameOp(R;RY((s(/sys/lib/python2.7/compiler/pycodegen.pyt storeName
scCs|jd|�dS(NtLOAD(R�(R;RY((s(/sys/lib/python2.7/compiler/pycodegen.pytloadNamescCs|jd|�dS(NtDELETE(R�(R;RY((s(/sys/lib/python2.7/compiler/pycodegen.pytdelNamescCs|j|�}|jj|�}|tkrd|jsM|j|d|�q|j|d|�n�|tkr�|j|d|�n�|tkr�|js�|j|d|�q|j|d|�nB|tks�t kr�j|d|�nt
d||f�dS(Nt_NAMEt_FASTt_GLOBALt_DEREFs unsupported scope for var %s: %d(R�tscopet
check_nameR t optimizedR�RR
RR
R0(R;tprefixRYR�((s(/sys/lib/python2.7/compiler/pycodegen.pyR�s cCs8|jr |j|d|�n|j|d|�dS(s�Emit name ops for names generated implicitly by for loops
The interpreter generates names that start with a period or
dollar sign. The symbol table ignores these names because
they aren't present in the program text.
R�R�N(R�R�(R;R�RY((s(/sys/lib/python2.7/compiler/pycodegen.pyt_implicitNameOp+s cCsTt|dd�}|dk rP||jks3|rP|jd|�||_tStS(s�Emit SET_LINENO if necessary.
The instruction is considered necessary if the node has a
lineno attribute and it is different than the last lineno
emitted.
Returns true if SET_LINENO was emitted.
There are no rules for when an AST node should have a lineno
attribute. The transformer and AST code need to be reviewed
and a consistent policy implemented and documented. Until
then, this method works around missing line numbers.
tlinenot
SET_LINENON(R�R/R|R�tTruetFalse(R;R_tforceR�((s(/sys/lib/python2.7/compiler/pycodegen.pyt
set_lineno<s cCs�|j|�|_|j||_|jdd�|jr^|jd|j�|jd�nt|j|j�dd�}|j j
|j��|j|j�|jdd�|jd�dS(NR�it
LOAD_CONSTRitverbosetRETURN_VALUE(R�R�R�R�tdocR�RR_R�RztpushR^tvisitR/(R;R_tlnf((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitModuleZs cCsP|j|�|j|�|_|j||_|j|j�|jd�dS(NR�(R�R�R�R�R�R_R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitExpressiongs
cCsC|j|dd�|jr/|j|j�n|j|j�dS(NtisLambdai(t_visitFuncOrLambdaR�R�R�RY(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyRbns cCs|j|dd�dS(NR�i(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyRctscCs|rI|jrIx!|jjD]}|j|�qWt|jj�}nd}|j||j||j|j��}t|j |�|j
�|j|�x|jD]}|j|�q�W|j
|t|j��x$t|�D]}|jdd�q�dS(NiRi(t
decoratorstnodesR�tlenR�R�R�RRR4tfinishR�tdefaultst_makeClosuretrangeR�(R;R_R�t decoratortndecoratorsR9tdefaultti((s(/sys/lib/python2.7/compiler/pycodegen.pyR�ws
cCs�|j||j|j��}t|j|�|j�|j|�|jd|j�x|j D]}|j
|�qbW|jdt|j ��|j|d�|jdd�|jd�|j
|j�dS(NR�tBUILD_TUPLEiRtBUILD_CLASS(R�R�RRR4R�R�R�RYtbasesR�R�R�R�(R;R_R9tbase((s(/sys/lib/python2.7/compiler/pycodegen.pyRg�s
cCs�|j�}t|j�}x�t|�D]�}|j|\}}t|�rSq(n|j|�|j|�|j�}|jd|�|j�|j|�|jd|�|j |�q(W|j
r�|j|j
�n|j|�dS(NtPOP_JUMP_IF_FALSEtJUMP_FORWARD(R�R�ttestsR�RmR�R�R�R�R�telse_(R;R_tendtnumtestsR�ttesttsuitetnextTest((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitIf�s"
cCs|j|�|j�}|j�}|j�}|jd|�|j|�|jjt|f�|j|dt�|j|j �|jd|p�|�|j�|j|j
�|jd|�|j|�|jd�|jj�|j
r
|j|j
�n|j|�dS(Nt
SETUP_LOOPR�R�t
JUMP_ABSOLUTEt POP_BLOCK(R�R�R�R�R{R�tLOOPR�R�R�tbodyR�tpopR�(R;R_tloopR�tafter((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitWhile�s&
cCs(|j�}|j�}|j�}|jjt|f�|j|�|jd|�|j|j�|jd�|j|�|j|dd�|jd|�|j|j �|j|j
�|jd|�|j|�|jd�|jj�|jr|j|j�n|j|�dS(NR�tGET_ITERR�itFOR_ITERR�R�(
R�R{R�R�R�R�R�tlistR�tassignR�R�R�(R;R_tstarttanchorR�((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitFor�s(
cCsC|js%td|j|jf�n|j|�|jd�dS(Ns'break' outside loop (%s, %d)t
BREAK_LOOP(R{R$R&R�R�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitBreak�s
cCs[|js%td|j|jf�n|jj�\}}|tkrp|j|�|jd|�|j�n�t ks�|t
kr)|j|�t|j�}x=|dkr�d}|j|\}}|tkr�Pq�q�W|tkrtd|j|jf�n|jd|�|j�n.|tkrWd}t||j|jf�ndS(Ns 'continue' outside loop (%s, %d)R�iit
CONTINUE_LOOPs7'continue' not allowed inside 'finally' clause (%s, %d)(
R{R$R&R�R�R�R�R�R�tEXCEPTtTRY_FINALLYR�tEND_FINALLY(R;R_tkindtblockR�t
loop_blockR�((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitContinue�s0
cCsp|j�}x<|jd D]-}|j|�|j||�|j�qW|j|jd�|j|�dS(Ni�(R�R�R�R�R�(R;R_tjumpR�tchild((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitTests
cCs|j|d�dS(NtJUMP_IF_FALSE_OR_POP(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAndscCs|j|d�dS(NtJUMP_IF_TRUE_OR_POP(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitOrscCs�|j�}|j�}|j|j�|jd|�|j|j�|jd|�|j|�|j|j�|j|�dS(NR�R�(R�R�R�R�tthenR�R�(R;R_tendblockt elseblock((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitIfExps
cCs3|j|j�|j�}xl|jd D]]\}}|j|�|jd�|jd�|jd|�|jd|�|j�q*W|jr�|jd\}}|j|�|jd|�nt|j�dkr/|j�}|jd|�|j|�|jd�|jd �|j|�ndS(
Ni�tDUP_TOPt ROT_THREEt
COMPARE_OPR�iR�tROT_TWOtPOP_TOP(R�texprR�topsR�R�R�R�(R;R_tcleanuptopR4R�((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitCompare s(
c CsF|j|�|jdd�g}x�ttt|j��|j�D]\}}|j|�\}}d}x<|jD]1}|dkr�|j �}n|j||�qvW|j
d|||f�qEW|j|j�|jdt|j�d�xJ|D]B\}}}|r!|j|�n|jd|�|j
|�q�S(Nt
BUILD_LISTitLIST_APPENDiR�(R�R�tzipR�R�tqualsR�R/tifsR�tinsertR�R�R�( R;R_tstackR�tfor_R�R�tconttif_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitListComp8s$
.c CsF|j|�|jdd�g}x�ttt|j��|j�D]\}}|j|�\}}d}x<|jD]1}|dkr�|j �}n|j||�qvW|j
d|||f�qEW|j|j�|jdt|j�d�xJ|D]B\}}}|r!|j|�n|jd|�|j
|�q�S(Nt BUILD_SETitSET_ADDiR�(R�R�RR�R�RR�R/RR�RR�R�R�( R;R_RR�R R�R�R
R((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitSetCompPs$
.c CsV|j|�|jdd�g}x�ttt|j��|j�D]\}}|j|�\}}d}x<|jD]1}|dkr�|j �}n|j||�qvW|j
d|||f�qEW|j|j�|j|j�|jdt|j�d�xJ|D]B\}}}|r1|j
|�n|jd|�|j|�qWdS(Nt BUILD_MAPitMAP_ADDiR�(R�R�RR�R�RR�R/RR�RRltkeyR�R�( R;R_RR�R R�R�R
R((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitDictComphs&
.cCs�|j�}|j�}|j|j�|jd�|j|�|j|dt�|jd|�|j�|j|j�||fS(NR�R�R�(R�R�R�R�R�R�R�R�(R;R_R�R�((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitListCompFor�s
cCsA|j|dt�|j|j�|jd|�|j�dS(NR�R�(R�R�R�R�R�R�(R;R_tbranch((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitListCompIf�scCs�|jj�}|rox|D]}|jd|�qW|jdt|��|jd|�|jd|�n |jd|�|jd|�dS(NtLOAD_CLOSURER�R�tMAKE_CLOSUREt
MAKE_FUNCTION(R�t
get_free_varsR�R�(R;R9targstfreesRY((s(/sys/lib/python2.7/compiler/pycodegen.pyR��s
cCs�t||j|j|j��}t|j|�|j�|j|�|j|d�|j |jj
dj�|jd�|jdd�dS(NiR�Ri(
tGenExprCodeGeneratorR�R�RRR4R�R�R�R�RtiterR�(R;R_R9((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitGenExpr�s
c
Css|j|�g}x�ttt|j��|j�D]�\}}|j|�\}}}d}x<|jD]1} |dkr�|j�}n|j| |�qiW|j d||||f�q5W|j|j
�|jd�|jd�xt|D]l\}}}}|r|j|�n|jd|�|j
|�|jd�|jj�|j|�q�|jdd�dS(NitYIELD_VALUER�R�R�R�(R�RR�R�RR�R/RR�RR�R�R�R�R{R�(
R;R_RR�R R�R�R�R
R((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitGenExprInner�s,
.
cCs�|j�}|j�}|j�}|jjt|f�|jd|�|jrc|jd�n|j|j�|jd�|j |�|j
|dt�|jd|�|j �|j|j�|||fS(NR�s.0R�R�R�(
R�R{R�R�R�t
is_outmostR�R�RR�R�R�R�(R;R_R�R�R�((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitGenExprFor�s
cCsA|j|dt�|j|j�|jd|�|j�dS(NR�R�(R�R�R�R�R�R�(R;R_R((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitGenExprIf�scCs�|j�}|j|�|j�|j|j�|jd|�|j�|jdd�|jr�|j|j�|jdd�n|jdd�|j|�dS(NtPOP_JUMP_IF_TRUEtLOAD_GLOBALR�t
RAISE_VARARGSii(R�R�R�R�R�R�tfail(R;R_R�((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAssert�s
cCs�|j|�d}|jr9|j|j�|d}n|jr_|j|j�|d}n|jr�|j|j�|d}n|jd|�dS(NiiR'(R�texpr1R�texpr2texpr3R�(R;R_tn((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitRaise�s
cCs9|j�}|j�}|j�}|jr<|j�}n|}|j|�|jd|�|j|�|jjt|f�|j|j �|jd�|jj
�|jd|�|j|�t|j
�d}xtt|j
��D]�|j
|\}} }|j|�|rt|jd�|j|�|jdd�|j�}
|jd|
�|j�n|jd �| r�|j| �n
|jd �|jd �|j|�|jd|�|r�j|
�q�j�q�jd
�|jr(|j|�|j|j�n|j|�dS(NtSETUP_EXCEPTR�R�iR�R�sexception matchR�R�R�(R�R�R�R�R�R{R�R�R�R�R�R�R�thandlersR�(R;R_R�R0R�tlElsetlastR�R�ttargettnext((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitTryExcept sR
cCs�|j�}|j�}|j|�|jd|�|j|�|jjt|f�|j|j�|jd�|jj �|jdd�|j|�|jjt|f�|j|j�|jd�|jj �dS(Nt
SETUP_FINALLYR�R�R�(
R�R�R�R�R{R�R�R�R�R�R/R�tfinal(R;R_R�R7((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitTryFinally8s
cCs�|j�}|j�}|jd7_d|j}|j|�|j|j�|jd�|jdd�|jd�|jdd�|jdd �|jdkr�|jd
�n|jd|�|jd|�|j |�|j
jt|f�|jdk r?|jd
|�|jd|�|j|j�n|j|j
�|jd�|j
j�|jdd�|j |�|j
jt|f�|jd�|jd�|j
j�|jd8_dS(Nis_[%d]R�t LOAD_ATTRt__exit__R�t __enter__RiR�R�R6R�R�R�R�tWITH_CLEANUPR�(R�t_CodeGenerator__with_countR�R�R�R�tvarsR/R�R�R{R�R�R�R�R�(R;R_R�R7tvaluevar((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitWithKs>
cCs.|j|�|j|j�|jd�dS(NR�(R�R�R�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitDiscardos
cCs|jd|j�dS(NR�(R�Rl(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitConsttscCs'|jd|j�|j|j�dS(NR�(R�RYR�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitKeywordwscCsdS(N((R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyRa{scCs!|j|�|j|j�dS(N(R�R�RY(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitNames
cCs|j|�dS(N(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitPass�scCs�|j|�|jjt�r%dnd}x�|jD]�\}}tdkrp|jd|�|jdd�n|jd|�|jd�d}|r�|j |�|j
|�q5|j
|�q5WdS(Nii�iR�tIMPORT_NAMEt.(R�R�t checkFlagRRVtVERSIONR�R/tsplitt_resolveDotsR�(R;R_tlevelRYRdR*((s(/sys/lib/python2.7/compiler/pycodegen.pyRe�s
cCsT|j|�|j}|dkr>|jjt�r>d}ntd�|jD��}tdkr�|jd|�|jd|�n|jd|j �x�|jD]�\}}tdkr/|dkr�|_
|jd�t|j�dks��dS|jd |�|j
|�|j|p(|�q�|jd |�q�W|jd
�dS(Nii�css|]\}}|VqdS(N((t.0RYRd((s(/sys/lib/python2.7/compiler/pycodegen.pys <genexpr>�siR�RFt*tIMPORT_STARtIMPORT_FROMR�(R�RLR�RHRttupleRVRIR�tmodnamet namespaceR�R�RKR�(R;R_RLtfromlistRYRd((s(/sys/lib/python2.7/compiler/pycodegen.pyRf�s*
cCsN|jd�}t|�dkr%dSx"|dD]}|jd|�q0WdS(NRGiR9(RJR�R�(R;RYteltsR]((s(/sys/lib/python2.7/compiler/pycodegen.pyRK�s
cCs0|j|j�|jd|j|j��dS(NR9(R�R�R�R�tattrname(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitGetattr�scCs�|j|�|j|j�t|j�d}xhtt|j��D]Q}|j|}||kru|jd�nt|tj �rF|j|�qFqFWdS(NiR�(
R�R�R�R�R�R�R�RjRtNode(R;R_tdupsR�R]((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAssign�s
cCsa|jdkr"|j|j�n;|jdkrQ|j|�|j|j�ndG|jGHdS(Nt OP_ASSIGNt OP_DELETEtoops(R7R�RYR�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyRh�s
cCs�|j|j�|jdkr>|jd|j|j��n?|jdkrl|jd|j|j��ndG|jGH|GHdS(NR[t
STORE_ATTRR\tDELETE_ATTRswarning: unexpected flags:(R�R�R7R�R�RV(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAssAttr�stUNPACK_SEQUENCEcCsSt|�dkr.|j|t|j��nx|jD]}|j|�q8WdS(NR\(tfindOpR�R�R�R�(R;R_RR�((s(/sys/lib/python2.7/compiler/pycodegen.pyt_visitAssSequence�sicCs|j|d�dS(NtUNPACK_TUPLE(Rc(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitAssTuple�scCs|j|d�dS(NtUNPACK_LIST(Rc(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAssList�scCsg|j|�t|j�}|j|d�|j|j�|j|j|j�|j|d�dS(Ntloadtstore(R�twrap_augR_R�R�R�t_augmented_opcodeR(R;R_taug_node((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAugAssign�s
tINPLACE_ADDs+=tINPLACE_SUBTRACTs-=tINPLACE_MULTIPLYs*=tINPLACE_DIVIDEs/=tINPLACE_FLOOR_DIVIDEs//=tINPLACE_MODULOs%=t
INPLACE_POWERs**=tINPLACE_RSHIFTs>>=tINPLACE_LSHIFTs<<=tINPLACE_ANDs&=tINPLACE_XORs^=t
INPLACE_ORs|=cCsB|dkr|j|j�n|dkr>|j|j�ndS(NRhRi(R�RYR�(R;R_R6((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAugNamescCs�|dkrH|j|j�|jd�|jd|j|j��n8|dkr�|jd�|jd|j|j��ndS(NRhR�R9RiR�R^(R�R�R�R�RV(R;R_R6((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAugGetattr s
cCs�|dkr|j|d�n�|dkr�d}|jrG|dB}n|jr]|dB}n|dkry|jd�n)|dkr�|jd�n
|jd �|jd
|�ndS(NRhiRiiiR�itROT_FOURR�sSTORE_SLICE+%d(t
visitSlicetlowertupperR�(R;R_R6tslice((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitAugSlices
cCsL|dkr|j|d�n)|dkrH|jd�|jd�ndS(NRhiRiR�tSTORE_SUBSCR(tvisitSubscriptR�(R;R_R6((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAugSubscript#s
cCs�|j|j�|jdkr2|jdd�n|j|j�|jdkra|jd�n|j|j�|jd�dS(NR�R�t EXEC_STMT(R�R�RzR/R�RW(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitExec*scCsd}d}|j|�|j|j�xG|jD]<}|j|�t|tj�re|d}q3|d}q3W|jdk r�|j|j�n|j dk r�|j|j �n|jdk }|j dk }t
||f}|j||d>|B�dS(Niii(R�R�R_RRjRtKeywordt star_argsR/t
dstar_argstcallfunc_opcode_infoR�(R;R_tpostkwtargt have_start
have_dstartopcode((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitCallFunc6s"
cCs�|j|�|jr)|j|j�nxj|jD]_}|jrR|jd�n|j|�|jr�|jd�|jd�q3|jd�q3W|jr�|r�|jd�ndS(NR�R�t
PRINT_ITEM_TOt
PRINT_ITEMR�(R�tdestR�R�R�(R;R_tnewlineR�((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitPrintJs
cCs=|j|dd�|jr,|jd�n
|jd�dS(NR�itPRINT_NEWLINE_TOt
PRINT_NEWLINE(R�R�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitPrintnlZs cCs.|j|�|j|j�|jd�dS(NR�(R�R�RlR�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitReturnas
cCs.|j|�|j|j�|jd�dS(NR (R�R�RlR�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitYieldfs
cCs2|j|j�d}|jr<|j|j�|dB}n|jrb|j|j�|dB}n|r�|dkr�|jd�q�|dkr�|jdd�q�|jdd�n|jdkr�|jd|�nU|jd kr�jd
|�n2|jdkr|jd|�nd
G|jGH�dS(NiiiR�itDUP_TOPXtOP_APPLYsSLICE+%dR[sSTORE_SLICE+%dR\sDELETE_SLICE+%dsweird slice(R�R�R~RR�R7(R;R_taug_flagR�((s(/sys/lib/python2.7/compiler/pycodegen.pyR}ms,
cCs�|j|j�x|jD]}|j|�qWt|j�dkrb|jdt|j��n|r{|jdd�n|jdkr�|jd�n>|jdkr�|jd�n|jd kr�|jd
�ndS(NiR�R�iR�t
BINARY_SUBSCRR[R�R\t
DELETE_SUBSCR(R�R�tsubsR�R�R7(R;R_R�tsub((s(/sys/lib/python2.7/compiler/pycodegen.pyR��scCs1|j|j�|j|j�|j|�dS(N(R�tlefttrightR�(R;R_R((s(/sys/lib/python2.7/compiler/pycodegen.pytbinaryOp�scCs|j|d�S(Nt
BINARY_ADD(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitAdd�scCs|j|d�S(NtBINARY_SUBTRACT(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitSub�scCs|j|d�S(NtBINARY_MULTIPLY(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitMul�scCs|j||j�S(N(R�R~(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitDiv�scCs|j|d�S(NtBINARY_FLOOR_DIVIDE(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitFloorDiv�scCs|j|d�S(Nt
BINARY_MODULO(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitMod�scCs|j|d�S(NtBINARY_POWER(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitPower�scCs|j|d�S(Nt
BINARY_LSHIFT(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitLeftShift�scCs|j|d�S(Nt
BINARY_RSHIFT(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitRightShift�scCs!|j|j�|j|�dS(N(R�R�R�(R;R_R((s(/sys/lib/python2.7/compiler/pycodegen.pytunaryOp�scCs|j|d�S(NtUNARY_INVERT(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitInvert�scCs|j|d�S(NtUNARY_NEGATIVE(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitUnarySub�scCs|j|d�S(NtUNARY_POSITIVE(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitUnaryAdd�scCs|j|d�S(NR�(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitUnaryInvert�scCs|j|d�S(Nt UNARY_NOT(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitNot�scCs|j|d�S(Nt
UNARY_CONVERT(R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitBackquote�scCsD|j|d�x,|dD] }|j|�|j|�qWdS(Nii(R�R�(R;R�RR_((s(/sys/lib/python2.7/compiler/pycodegen.pytbitOp�s
cCs|j|jd�S(Nt
BINARY_AND(R�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitBitand�scCs|j|jd�S(Nt BINARY_OR(R�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitBitor�scCs|j|jd�S(Nt
BINARY_XOR(R�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitBitxor�scCs|jdt�dS(NR�(R�tEllipsis(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitEllipsis�scCsK|j|�x|jD]}|j|�qW|jdt|j��dS(NR�(R�R�R�R�R�(R;R_R]((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitTuple�s
cCsK|j|�x|jD]}|j|�qW|jdt|j��dS(NR(R�R�R�R�R�(R;R_R]((s(/sys/lib/python2.7/compiler/pycodegen.pyt visitList�s
cCsK|j|�x|jD]}|j|�qW|jdt|j��dS(NR
(R�R�R�R�R�(R;R_R]((s(/sys/lib/python2.7/compiler/pycodegen.pytvisitSet�s
cCs>x|jD]}|j|�q
W|jdt|j��dS(NtBUILD_SLICE(R�R�R�R�(R;R_R�((s(/sys/lib/python2.7/compiler/pycodegen.pyt
visitSliceobj�scCs||j|�|jdd�xX|jD]M\}}|jd�|j|�|j|�|jd�|jd�q'WdS(NRiR�R�R�(R�R�titemsR�(R;R_tktv((s(/sys/lib/python2.7/compiler/pycodegen.pyR`�s
N(uRBRCRiR�R/RuR�R<RvRxR}RAR�R�RR�R�R�R�R�R�R�R�RTR�R�R�R�R�RbRcR�RgR�R�R�R�R�R�R�R�R�RRRRRRR�RR!R#R$R)R.R5R8R=R@RARBRCRaRDREReRfRKRWRZRhR`RcRIReRgRmRkRzR{R�R�R�R�R�R�R�R�R}R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R`(((s(/sys/lib/python2.7/compiler/pycodegen.pyRn�s�
/ $
tNestedScopeMixincBseZdZd�ZRS(s>Defines initClass() for nested scoping (Python 2.2-compatible)cCs(t|j_t|j_t|j_dS(N(RTRwR�tFunctionCodeGeneratorR�tClassCodeGeneratorR�(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyRv
s(RBRCRiRv(((s(/sys/lib/python2.7/compiler/pycodegen.pyR�sRFcBs)eZejZdZd�Zd�ZRS(cCsEtjd|j�|_tj|�|_|j�t||�dS(Ns<module>( RtPyFlowGraphR&R�Rtfind_futuresR�t _ModuleCodeGenerator__super_initR(R;R?((s(/sys/lib/python2.7/compiler/pycodegen.pyR<s
cCs|S(N((R;((s(/sys/lib/python2.7/compiler/pycodegen.pyRsN(RBRCRnR<R�R/R�R(((s(/sys/lib/python2.7/compiler/pycodegen.pyRFs RDcBs/eZejZdZdZd�Zd�ZRS(cCs3tjd|j�|_|j�t||�dS(Ns<expression>(RR�R&R�t$_ExpressionCodeGenerator__super_initR(R;R?((s(/sys/lib/python2.7/compiler/pycodegen.pyR<#s
cCs|S(N((R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR(sN(( RBRCRnR<R�R/R�R�R(((s(/sys/lib/python2.7/compiler/pycodegen.pyRDs
REcBs8eZejZdZdZd�Zd�Zd�Z RS(cCsMtjd|j�|_|j�|j|�t||�|jd�dS(Ns
<interactive>R�(RR�R&R�t%_InteractiveCodeGenerator__super_initR�RR�(R;R?((s(/sys/lib/python2.7/compiler/pycodegen.pyR<2s
cCs|S(N((R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR9scCs!|j|j�|jd�dS(Nt
PRINT_EXPR(R�R�R�(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyRA<sN((
RBRCRnR<R�R/R�R�RRA(((s(/sys/lib/python2.7/compiler/pycodegen.pyRE+s tAbstractFunctionCodecBsGeZdZdZd�Zd�Zd�Zd�Zd�ZeZ RS(iicCsL||_||_|r>t}d|j}|jd|_n |j}t|j�\}} tj||j |dd�|_
||_|j�|r�|j
r�|j|j
�nt|j|j|�dd�}
|jj|
j��|jr|j
jt�n|jr"|j
jt�n|j|�| rH|j|j�ndS(Ns<lambda.%d>iR�R�i(R�tmoduleR�tlambdaCountRYtgenerateArgListtargnamesRR�R&R�R�t
super_initR�R�RR4R�RzR�R^tvarargsR�RtkwargsRR�tgenerateArgUnpack(R;tfuncR�R�R�R*tklassRYRthasTupleArgR�((s(/sys/lib/python2.7/compiler/pycodegen.pyR<Fs.
!
cCs|jS(N(R�(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyRcscCs:|jj�|js)|jdd�n|jd�dS(NR�R�(R�tstartExitBlockR�R�R/(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR�fs
cCsbx[tt|��D]G}||}t|t�r|jdd|d�|j|�qqWdS(Nt LOAD_FASTs.%di(R�R�RjRQR�tunpackSequence(R;RR�R�((s(/sys/lib/python2.7/compiler/pycodegen.pyR�ls
cCstdkr%|jdt|��n|jdt|��x=|D]5}t|t�rg|j|�qB|jd|�qBWdS(NiRaRdR�(RIR�R�RjRQR�R�(R;ttupR]((s(/sys/lib/python2.7/compiler/pycodegen.pyR�ss
(
RBRCR�R�R<RR�R�R�tunpackTuple(((s(/sys/lib/python2.7/compiler/pycodegen.pyR�Bs R�cBs)eZejZdZejZd�ZRS(cCs�||_|||_|j|||||�|jj|jj��|jj|jj��|jjdk r�|jj
t�ndS(N(R�R�t"_FunctionCodeGenerator__super_initR�tsetFreeVarsRtsetCellVarst
get_cell_varst generatorR/R�R(R;R�R�R�R�R*((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�s
N( RBRCRnR<R�R/R�R�R�(((s(/sys/lib/python2.7/compiler/pycodegen.pyR��s RcBs)eZejZdZejZd�ZRS(cCsu||_|||_|j||d||�|jj|jj��|jj|jj��|jjt �dS(Ni(
R�R�t!_GenExprCodeGenerator__super_initR�R�RR�R�R�R(R;tgexpR�R�R*((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�s
N( RBRCRnR<R�R/R�R�R�(((s(/sys/lib/python2.7/compiler/pycodegen.pyR�s tAbstractClassCodecBs#eZd�Zd�Zd�ZRS(cCs�|j|_||_tj|j|jdddd�|_|j�t|j |j
�dd�}|jj|j
��|jjt�|jr�|j|j�ndS(NR�iR�iR�(RYR�R�RR�R&R�R�RR4R�RzR�R^R�RR�R�(R;R�R�R�R�((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�s
cCs|jS(N(R�(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR�scCs+|jj�|jd�|jd�dS(NtLOAD_LOCALSR�(R�R�R�(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR��s
(RBRCR<RR�(((s(/sys/lib/python2.7/compiler/pycodegen.pyR��s R�cBs)eZejZdZejZd�ZRS(cCs�||_|||_|j|||�|jj|jj��|jj|jj��|j|�|j dd�|j
d�|jr�|j d|j�|j
d�ndS(NR&RBRCR�Ri(R�R�t_ClassCodeGenerator__super_initR�R�RR�R�R�R�R�R�(R;R�R�R�((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�s
N( RBRCRnR<R�R/R�R�R�(((s(/sys/lib/python2.7/compiler/pycodegen.pyR��s cCs�g}g}d}x�tt|��D]�}||}t|t�rT|j|�q%t|t�r�|jt|d|��|jtj |��|d}q%t
d|�q%W|||fS(s&Generate an arg list marking TupleArgsiiisunexpect argument type:(R�R�RjtstrtappendRQRtextendRtflattenR3(targlistRtextratcountR�R]((s(/sys/lib/python2.7/compiler/pycodegen.pyR��s
cCs#t�}t||dd�|jS(s5Find the op (DELETE, LOAD, STORE) in an AssTuple treeR�i(tOpFinderRR(R_R�((s(/sys/lib/python2.7/compiler/pycodegen.pyRb�s R�cBs&eZd�Zd�ZeZeZRS(cCs
d|_dS(N(R/R(R;((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�scCs@|jdkr|j|_n|j|jkr<td�ndS(Nsmixed ops in stmt(RR/R7R3(R;R_((s(/sys/lib/python2.7/compiler/pycodegen.pyRh�s(RBRCR<RhR`R�(((s(/sys/lib/python2.7/compiler/pycodegen.pyR��s t DelegatorcBs eZdZd�Zd�ZRS(sBase class to support delegation for augmented assignment nodes
To generator code for augmented assignments, we use the following
wrapper classes. In visitAugAssign, the left-hand expression node
is visited twice. The first time the visit uses the normal method
for that node . The second time the visit uses a different method
that generates the appropriate code to perform the assignment.
These delegator classes wrap the original AST nodes in order to
support the variant visit methods.
cCs
||_dS(N(tobj(R;R((s(/sys/lib/python2.7/compiler/pycodegen.pyR<�scCst|j|�S(N(R�R(R;tattr((s(/sys/lib/python2.7/compiler/pycodegen.pyt__getattr__�s(RBRCRiR<R(((s(/sys/lib/python2.7/compiler/pycodegen.pyR�s
t
AugGetattrcBseZRS((RBRC(((s(/sys/lib/python2.7/compiler/pycodegen.pyR�stAugNamecBseZRS((RBRC(((s(/sys/lib/python2.7/compiler/pycodegen.pyR�stAugSlicecBseZRS((RBRC(((s(/sys/lib/python2.7/compiler/pycodegen.pyRstAugSubscriptcBseZRS((RBRC(((s(/sys/lib/python2.7/compiler/pycodegen.pyRscCst|j|�S(N(twrapperRw(R_((s(/sys/lib/python2.7/compiler/pycodegen.pyRjst__main__(MRRRKRJRNtsyst cStringIORtcompilerRRRRRRRRtcompiler.constsR R
RRR
RRRRRRRRRtcompiler.pyassemRtversion_infoRItAttributeErrorR�R�R�R�R�R+R/R#R:R2R1R"RTRmRnR�RFRDRER�R�RR�R�R�RbR�RRRRRtGetattrtNametSlicet SubscriptRRjRBtargvtfile(((s(/sys/lib/python2.7/compiler/pycodegen.pyt<module>s�""(@
+ ��U>
|