ofc@sddlZddlZddlZddlZddlZddlmZddlmZm Z m Z m Z ddlm Z m Z mZmZddlmZmZmZmZmZddlmZmZmZmZmZmZmZmZmZddlm Z yej!dZ"Wne#k r2d Z"nXid ddf6d d df6d dd f6d d d f6Z$d Z%dZ&dZ'dZ(ddZ)e*e*dZ+dfdYZ,de,fdYZ-de,fdYZ.de,fdYZ/dfdYZ0dZ1dfdYZ2d fd!YZ3d"e3e2fd#YZ4d$e3e2fd%YZ5d&e3e2fd'YZ6d(fd)YZ7d*e3e7e2fd+YZ8d,e3e7e2fd-YZ9d.fd/YZ:d0e3e:e2fd1YZ;d2Z<d3Z=d4fd5YZ>d6fd7YZ?d8e?fd9YZ@d:e?fd;YZAd<e?fd=YZBd>e?fd?YZCie@ejD6eAejE6eBejF6eCejG6ZHd@ZIeJdAkrxejKd D]ZLe)eLqWndS(BiN(tStringIO(tasttparsetwalktsyntax(tpyassemtmisctfuturetsymbols(tSC_LOCALtSC_GLOBAL_IMPLICITtSC_GLOBAL_EXPLICITtSC_FREEtSC_CELL( t CO_VARARGStCO_VARKEYWORDSt CO_NEWLOCALSt CO_NESTEDt CO_GENERATORtCO_FUTURE_DIVISIONtCO_FUTURE_ABSIMPORTtCO_FUTURE_WITH_STATEMENTtCO_FUTURE_PRINT_FUNCTION(tTupleArgiit CALL_FUNCTIONtCALL_FUNCTION_VARtCALL_FUNCTION_KWtCALL_FUNCTION_VAR_KWiiicCst|d}|j}|jt||}y|j|Wntk r[n+Xt|dd}|j||jdS(NtUtctwb(topentreadtclosetModuletcompilet SyntaxErrortdump(tfilenametdisplaytftbuftmod((s*/usr/lib64/python2.7/compiler/pycodegen.pyt compileFile%s    cCs|dk s|dk r$tdn|dkrBt||}nH|dkr`t||}n*|dkr~t||}n td|j|jS(s*Replacement for builtin compile() functionsnot implemented yettsingletexectevals6compile() 3rd arg must be 'exec' or 'eval' or 'single'N(tNonet RuntimeErrort InteractiveR"t Expressiont ValueErrorR#tcode(tsourceR&tmodetflagst dont_inherittgen((s*/usr/lib64/python2.7/compiler/pycodegen.pyR#3s      tAbstractCompileModecBs2eZdZdZdZdZdZRS(cCs||_||_d|_dS(N(R5R&R/R4(tselfR5R&((s*/usr/lib64/python2.7/compiler/pycodegen.pyt__init__Hs  cCs9t|j|j}tj|j|tj||S(N(RR5R6Rt set_filenameR&Rtcheck(R;ttree((s*/usr/lib64/python2.7/compiler/pycodegen.pyt _get_treeMs cCsdS(N((R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyR#SscCs|jS(N(R4(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pytgetCodeVsN(t__name__t __module__R/R6R<R@R#RA(((s*/usr/lib64/python2.7/compiler/pycodegen.pyR:Ds    R2cBseZdZdZRS(R.cCs+|j}t|}|j|_dS(N(R@tExpressionCodeGeneratorRAR4(R;R?R9((s*/usr/lib64/python2.7/compiler/pycodegen.pyR#]s  (RBRCR6R#(((s*/usr/lib64/python2.7/compiler/pycodegen.pyR2YsR1cBseZdZdZRS(R,cCs+|j}t|}|j|_dS(N(R@tInteractiveCodeGeneratorRAR4(R;R?R9((s*/usr/lib64/python2.7/compiler/pycodegen.pyR#fs  (RBRCR6R#(((s*/usr/lib64/python2.7/compiler/pycodegen.pyR1bsR"cBs8eZdZddZdZejZdZRS(R-icCsN|j}t|}|r;ddl}|j|GHn|j|_dS(Ni(R@tModuleCodeGeneratortpprintRAR4(R;R'R?R9RG((s*/usr/lib64/python2.7/compiler/pycodegen.pyR#os    cCs*|j|jtj|j|dS(N(twritet getPycHeadertmarshalR%R4(R;R(((s*/usr/lib64/python2.7/compiler/pycodegen.pyR%wscCs2tjj|j}tjd|}|j|S(Nsd4Z?d5Z@d6ZAd7ZBd8ZCd9ZDd:ZEd;ZFd<ZGd=d>ZHeId?krveHZJeHZKnd@ZJdAZKdBZLi dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6ZMd[ZNd\ZOd]ZPd^ZQd_ZRd`ZSddaZTdbZUdcZVddZWddeZXddfZYdgZZdhZ[diZ\djZ]dkZ^dlZ_dmZ`dnZadoZbdpZcdqZddrZedsZfdtZgduZhdvZidwZjdxZkdyZldzZmd{Znd|Zod}Zpd~ZqdZrdZsdZtRS(sDefines 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(|jd|j_n|jtj|_tj|_d|_ |j d|_ |j j }x|D]}|dkr|jjtd|_ q|dkr|jjtq|dkr|jjtq|dkr|jjtqqWdS(Nit BINARY_DIVIDEtdivisiontBINARY_TRUE_DIVIDEtabsolute_importtwith_statementtprint_function(t_CodeGenerator__initializedR/t initClasst __class__t checkClassRtStacktlocalstsetupst last_linenot_setupGraphDelegationt_div_opt get_moduletfuturestgraphtsetFlagRRRR(R;Rtfeature((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<s(           cCsdS(s)This method is called once for each classN((R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRvscCs7yWn,tk r2}d|jj}t|nXdS(s*Verify that class is constructed correctlysBad class construction for %sN(tAssertionErrorRwRB(R;tmsgtintro((s*/usr/lib64/python2.7/compiler/pycodegen.pyRxs cCsO|jj|_|jj|_|jj|_|jj|_|jj|_dS(N(RtemittnewBlockt startBlockt nextBlockt setDocstring(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyR}s cCs |jjS(sReturn a code object(RRA(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRAscCs*|jdk r"tj||jS|SdS(N(t class_nameR/Rtmangle(R;RY((s*/usr/lib64/python2.7/compiler/pycodegen.pyRscCs tj}t|||jS(N(Rt SymbolVisitorRtscopes(R;R?ts((s*/usr/lib64/python2.7/compiler/pycodegen.pyt parseSymbolss  cCs tddS(Ns#should be implemented by subclasses(R0(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRscCs|jjj|S(N(RzttopR[(R;RY((s*/usr/lib64/python2.7/compiler/pycodegen.pyt isLocalName scCs|jd|dS(NtSTORE(t_nameOp(R;RY((s*/usr/lib64/python2.7/compiler/pycodegen.pyt storeName scCs|jd|dS(NtLOAD(R(R;RY((s*/usr/lib64/python2.7/compiler/pycodegen.pytloadNamescCs|jd|dS(NtDELETE(R(R;RY((s*/usr/lib64/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||fdS(Nt_NAMEt_FASTt_GLOBALt_DEREFs unsupported scope for var %s: %d( Rtscopet check_nameR t optimizedRR R R R R0(R;tprefixRYR((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs      cCs8|jr |j|d|n|j|d|dS(sEmit 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. RRN(RR(R;RRY((s*/usr/lib64/python2.7/compiler/pycodegen.pyt_implicitNameOp+s cCsTt|dd}|dk rP||jks3|rP|jd|||_tStS(sEmit 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(tgetattrR/R|RtTruetFalse(R;R_tforceR((s*/usr/lib64/python2.7/compiler/pycodegen.pyt set_lineno<s cCs|j||_|j||_|jdd|jr^|jd|j|jdnt|j|jdd}|j j |j |j |j|jdd|jddS(NRit LOAD_CONSTRitverboset RETURN_VALUE(RRRRtdocRRR_t NameFinderRztpushR^tvisitR/(R;R_tlnf((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitModuleZs cCsP|j||j||_|j||_|j|j|jddS(NR(RRRRRR_R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitExpressiongs  cCsC|j|dd|jr/|j|jn|j|jdS(NtisLambdai(t_visitFuncOrLambdaRRRRY(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyRbns cCs|j|dddS(NRi(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyRctscCs| rI|jrIx!|jjD]}|j|qWt|jj}nd}|j||j||j|j}t|j ||j |j |x|j D]}|j|qW|j |t|j x$t|D]}|jddqWdS(NiRi(t decoratorstnodesRtlent FunctionGenRRRRR4tfinishRtdefaultst _makeClosuretrangeR(R;R_Rt decoratort ndecoratorsR9tdefaultti((s*/usr/lib64/python2.7/compiler/pycodegen.pyRws  cCs|j||j|j}t|j||j|j||jd|jx|j D]}|j |qbW|jdt |j |j |d|jdd|jd|j |jdS(NRt BUILD_TUPLEiRt BUILD_CLASS(tClassGenRRRR4RRRRYtbasesRRRR(R;R_R9tbase((s*/usr/lib64/python2.7/compiler/pycodegen.pyRgs   cCs|j}t|j}xt|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_FALSEt JUMP_FORWARD( RRttestsRRmRRRRRtelse_(R;R_tendtnumtestsRttesttsuitetnextTest((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitIfs"        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_LOOPRRt JUMP_ABSOLUTEt POP_BLOCK(RRRRR{RtLOOPRRRtbodyRtpopR(R;R_tloopRtafter((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitWhiles&          cCs(|j}|j}|j}|jjt|f|j||jd||j|j|jd|j||j|dd|jd||j|j |j|j |jd||j||jd|jj |j r|j|j n|j|dS(NRtGET_ITERRitFOR_ITERRR( RR{RRRRRtlistRtassignRRR(R;R_tstarttanchorR((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitFors(          cCsC|js%td|j|jfn|j||jddS(Ns'break' outside loop (%s, %d)t BREAK_LOOP(R{R$R&RRR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitBreaks   cCs[|js%td|j|jfn|jj\}}|tkrp|j||jd||jn|t ks|t kr)|j|t |j}x=|dkr|d}|j|\}}|tkrPqqW|tkr td|j|jfn|jd||jn.|t krWd}t||j|jfndS(Ns 'continue' outside loop (%s, %d)Riit CONTINUE_LOOPs7'continue' not allowed inside 'finally' clause (%s, %d)( R{R$R&RRRRRRtEXCEPTt TRY_FINALLYRt END_FINALLY(R;R_tkindtblockRt loop_blockR((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitContinues0          cCsp|j}x<|jd D]-}|j||j|||jqW|j|jd|j|dS(Ni(RRRRR(R;R_tjumpRtchild((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitTests  cCs|j|ddS(NtJUMP_IF_FALSE_OR_POP(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitAndscCs|j|ddS(NtJUMP_IF_TRUE_OR_POP(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitOrscCs|j}|j}|j|j|jd||j|j|jd||j||j|j|j|dS(NRR(RRRRtthenRR(R;R_tendblockt elseblock((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitIfExps   cCs3|j|j|j}xl|jd D]]\}}|j||jd|jd|jd||jd||jq*W|jr|jd\}}|j||jd|nt|jdkr/|j}|jd||j||jd|jd |j|ndS( NitDUP_TOPt ROT_THREEt COMPARE_OPRiRtROT_TWOtPOP_TOP(RtexprRtopsRRRR(R;R_tcleanuptopR4R((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitCompare s(          c CsF|j||jddg}xttt|j|jD]\}}|j|\}}d}x<|jD]1}|dkr|j }n|j||qvW|j d|||fqEW|j|j |jdt|jdxJ|D]B\}}}|r!|j |n|jd||j |qWdS(Nt BUILD_LISTit LIST_APPENDiR(RRtzipRRtqualsRR/tifsRtinsertRRR( R;R_tstackRtfor_RRtconttif_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitListComp8s$ . c CsF|j||jddg}xttt|j|jD]\}}|j|\}}d}x<|jD]1}|dkr|j }n|j||qvW|j d|||fqEW|j|j |jdt|jdxJ|D]B\}}}|r!|j |n|jd||j |qWdS(Nt BUILD_SETitSET_ADDiR(RRRRRRRR/RRRRRR( R;R_RRRRRR R ((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitSetCompPs$ . c CsV|j||jddg}xttt|j|jD]\}}|j|\}}d}x<|jD]1}|dkr|j }n|j||qvW|j d|||fqEW|j|j |j|j |jdt|jdxJ|D]B\}}}|r1|j |n|jd||j|q WdS(Nt BUILD_MAPitMAP_ADDiR(RRRRRRRR/RRRRltkeyRR( R;R_RRRRRR R ((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitDictComphs& . cCs|j}|j}|j|j|jd|j||j|dt|jd||j|j|j||fS(NRRR(RRRRRRRR(R;R_RR((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitListCompFors     cCsA|j|dt|j|j|jd||jdS(NRR(RRRRRR(R;R_tbranch((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitListCompIfscCs|jj}|rox|D]}|jd|qW|jdt||jd||jd|n |jd||jd|dS(Nt LOAD_CLOSURERRt MAKE_CLOSUREt MAKE_FUNCTION(Rt get_free_varsRR(R;R9targstfreesRY((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs cCst||j|j|j}t|j||j|j||j|d|j |jj dj |j d|j dddS(NiRRi( tGenExprCodeGeneratorRRRRR4RRRRRtiterR(R;R_R9((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitGenExprs   c Css|j|g}xttt|j|jD]\}}|j|\}}}d}x<|jD]1} |dkr|j}n|j| |qiW|j d||||fq5W|j|j |j d|j dxt|D]l\}}}}|r|j |n|j d||j ||j d|jj|j |qW|j dddS(Nit YIELD_VALUERRRR(RRRRRRR/RRRRRRRR{R( R;R_RRRRRRR R ((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitGenExprInners, .       cCs|j}|j}|j}|jjt|f|jd||jrc|jdn|j|j|jd|j ||j |dt |jd||j |j|j |||fS(NRs.0RRR( RR{RRRt is_outmostRRRRRRR(R;R_RRR((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitGenExprFors       cCsA|j|dt|j|j|jd||jdS(NRR(RRRRRR(R;R_R((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitGenExprIfscCsdS(N((R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAssertscCs|j|d}|jr9|j|j|d}n|jr_|j|j|d}n|jr|j|j|d}n|jd|dS(Niit RAISE_VARARGS(Rtexpr1Rtexpr2texpr3R(R;R_tn((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitRaises       c Cs9|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| |jn|jd | r|j| n |jd |jd |j||jd||r|j| q|jqW|jd |jr(|j||j|jn|j|dS( Nt SETUP_EXCEPTRRiRRsexception matchRRR(RRRRRR{RRRRRRRthandlersR( R;R_RR,RtlElsetlastRRttargettnext((s*/usr/lib64/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_FINALLYRRR( RRRRR{RRRRRR/Rtfinal(R;R_RR3((s*/usr/lib64/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 j t |f|jdk r?|jd ||jd||j|jn|j|j |jd|j j|jdd|j ||j j t|f|jd|jd|j j|jd8_dS(Nis_[%d]Rt LOAD_ATTRt__exit__Rt __enter__RiRRR2RRRRt WITH_CLEANUPR(Rt_CodeGenerator__with_countRRRRtvarsR/RRR{RRRRR(R;R_RR3tvaluevar((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitWithKs>             cCs.|j||j|j|jddS(NR(RRRR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitDiscardos cCs|jd|jdS(NR(RRl(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitConsttscCs'|jd|j|j|jdS(NR(RRYRR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitKeywordwscCsdS(N((R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyRa{scCs!|j||j|jdS(N(RRRY(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitNames cCs|j|dS(N(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitPassscCs|j||jjtr%dnd}x|jD]\}}tdkrp|jd||jddn|jd||jdd}|r|j ||j |q5|j |q5WdS(NiiiRt IMPORT_NAMEt.( RRt checkFlagRRVtVERSIONRR/tsplitt _resolveDotsR(R;R_tlevelRYRdR*((s*/usr/lib64/python2.7/compiler/pycodegen.pyRes   cCs9|j||j}|dkr>|jjt r>d}ntd|jD}tdkr|jd||jd|n|jd|j x|jD]\}}tdkr|dkrd|_ |jddS|jd ||j ||j |p |q|jd |qW|jd dS( Niicss|]\}}|VqdS(N((t.0RYRd((s*/usr/lib64/python2.7/compiler/pycodegen.pys siRRBt*t IMPORT_STARt IMPORT_FROMR( RRHRRDRttupleRVRERtmodnamet namespaceRGR(R;R_RHtfromlistRYRd((s*/usr/lib64/python2.7/compiler/pycodegen.pyRfs(         cCsN|jd}t|dkr%dSx"|dD]}|jd|q0WdS(NRCiR5(RFRR(R;RYteltsR]((s*/usr/lib64/python2.7/compiler/pycodegen.pyRGs cCs0|j|j|jd|j|jdS(NR5(RRRRtattrname(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitGetattrscCs|j||j|jt|jd}xhtt|jD]Q}|j|}||kru|jdnt|tj rF|j|qFqFWdS(NiR( RRRRRRRRjRtNode(R;R_tdupsRR]((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAssigns   cCsa|jdkr"|j|jn;|jdkrQ|j||j|jn dG|jGHdS(Nt OP_ASSIGNt OP_DELETEtoops(R7RRYRR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyRhs  cCs|j|j|jdkr>|jd|j|jn?|jdkrl|jd|j|jndG|jGH|GHdS(NRWt STORE_ATTRRXt DELETE_ATTRswarning: unexpected flags:(RRR7RRRR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAssAttrs tUNPACK_SEQUENCEcCsSt|dkr.|j|t|jnx|jD]}|j|q8WdS(NRX(tfindOpRRRR(R;R_RR((s*/usr/lib64/python2.7/compiler/pycodegen.pyt_visitAssSequencesicCs|j|ddS(Nt UNPACK_TUPLE(R_(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAssTuplescCs|j|ddS(Nt UNPACK_LIST(R_(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAssListscCsg|j|t|j}|j|d|j|j|j|j|j|j|ddS(Ntloadtstore(Rtwrap_augR_RRRt_augmented_opcodeR(R;R_taug_node((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitAugAssigns  t INPLACE_ADDs+=tINPLACE_SUBTRACTs-=tINPLACE_MULTIPLYs*=tINPLACE_DIVIDEs/=tINPLACE_FLOOR_DIVIDEs//=tINPLACE_MODULOs%=t INPLACE_POWERs**=tINPLACE_RSHIFTs>>=tINPLACE_LSHIFTs<<=t INPLACE_ANDs&=t INPLACE_XORs^=t INPLACE_ORs|=cCsB|dkr|j|jn|dkr>|j|jndS(NRdRe(RRYR(R;R_R6((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAugNames  cCs|dkrH|j|j|jd|jd|j|jn8|dkr|jd|jd|j|jndS(NRdRR5ReRRZ(RRRRRR(R;R_R6((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitAugGetattr s    cCs|dkr|j|dn|dkrd}|jrG|dB}n|jr]|dB}n|dkry|jdn)|dkr|jdn |jd |jd |ndS( NRdiReiiRitROT_FOURRsSTORE_SLICE+%d(t visitSlicetlowertupperR(R;R_R6tslice((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAugSlices         cCsL|dkr|j|dn)|dkrH|jd|jdndS(NRdiReRt STORE_SUBSCR(tvisitSubscriptR(R;R_R6((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitAugSubscript#s    cCs|j|j|jdkr2|jddn|j|j|jdkra|jdn|j|j|jddS(NRRt EXEC_STMT(RRRzR/RRW(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitExec*scCsd}d}|j||j|jxG|jD]<}|j|t|tjre|d}q3|d}q3W|jdk r|j|jn|j dk r|j|j n|jdk }|j dk }t ||f}|j ||d>|BdS(Niii( RRR_RRjRtKeywordt star_argsR/t dstar_argstcallfunc_opcode_infoR(R;R_tpostkwtargt have_start have_dstartopcode((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitCallFunc6s"   cCs|j||jr)|j|jnxj|jD]_}|jrR|jdn|j||jr|jd|jdq3|jdq3W|jr| r|jdndS(NRRt PRINT_ITEM_TOt PRINT_ITEMR(RtdestRRR(R;R_tnewlineR((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitPrintJs      cCs=|j|dd|jr,|jdn |jddS(NRitPRINT_NEWLINE_TOt PRINT_NEWLINE(RRR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitPrintnlZs cCs.|j||j|j|jddS(NR(RRRlR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitReturnas cCs.|j||j|j|jddS(NR(RRRlR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitYieldfs cCs2|j|jd}|jr<|j|j|dB}n|jrb|j|j|dB}n|r|dkr|jdq|dkr|jddq|jddn|jdkr|jd|nU|jd kr|jd |n2|jd kr|jd |nd G|jGHdS(NiiiRitDUP_TOPXtOP_APPLYsSLICE+%dRWsSTORE_SLICE+%dRXsDELETE_SLICE+%ds weird slice(RRRzR{RR7(R;R_taug_flagR|((s*/usr/lib64/python2.7/compiler/pycodegen.pyRyms,       cCs|j|jx|jD]}|j|qWt|jdkrb|jdt|jn|r{|jddn|jdkr|jdn>|jdkr|jdn|jd kr|jd ndS( NiRRiRt BINARY_SUBSCRRWR~RXt DELETE_SUBSCR(RRtsubsRRR7(R;R_Rtsub((s*/usr/lib64/python2.7/compiler/pycodegen.pyRscCs1|j|j|j|j|j|dS(N(RtlefttrightR(R;R_R((s*/usr/lib64/python2.7/compiler/pycodegen.pytbinaryOpscCs|j|dS(Nt BINARY_ADD(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitAddscCs|j|dS(NtBINARY_SUBTRACT(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitSubscCs|j|dS(NtBINARY_MULTIPLY(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitMulscCs|j||jS(N(RR~(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitDivscCs|j|dS(NtBINARY_FLOOR_DIVIDE(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitFloorDivscCs|j|dS(Nt BINARY_MODULO(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitModscCs|j|dS(Nt BINARY_POWER(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitPowerscCs|j|dS(Nt BINARY_LSHIFT(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitLeftShiftscCs|j|dS(Nt BINARY_RSHIFT(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitRightShiftscCs!|j|j|j|dS(N(RRR(R;R_R((s*/usr/lib64/python2.7/compiler/pycodegen.pytunaryOpscCs|j|dS(Nt UNARY_INVERT(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitInvertscCs|j|dS(NtUNARY_NEGATIVE(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitUnarySubscCs|j|dS(NtUNARY_POSITIVE(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitUnaryAddscCs|j|dS(NR(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitUnaryInvertscCs|j|dS(Nt UNARY_NOT(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitNotscCs|j|dS(Nt UNARY_CONVERT(R(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitBackquotescCsD|j|dx,|dD] }|j||j|qWdS(Nii(RR(R;RRR_((s*/usr/lib64/python2.7/compiler/pycodegen.pytbitOps cCs|j|jdS(Nt BINARY_AND(RR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitBitandscCs|j|jdS(Nt BINARY_OR(RR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitBitorscCs|j|jdS(Nt BINARY_XOR(RR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitBitxorscCs|jdtdS(NR(RtEllipsis(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitEllipsisscCsK|j|x|jD]}|j|qW|jdt|jdS(NR(RRRRR(R;R_R]((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitTuples cCsK|j|x|jD]}|j|qW|jdt|jdS(NR(RRRRR(R;R_R]((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitLists cCsK|j|x|jD]}|j|qW|jdt|jdS(NR (RRRRR(R;R_R]((s*/usr/lib64/python2.7/compiler/pycodegen.pytvisitSets cCs>x|jD]}|j|q W|jdt|jdS(Nt BUILD_SLICE(RRRR(R;R_R((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitSliceobjscCs||j||jddxX|jD]M\}}|jd|j||j||jd|jdq'WdS(NRiRRR~(RRtitemsR(R;R_tktv((s*/usr/lib64/python2.7/compiler/pycodegen.pyR`s     N(uRBRCRiRR/RuRR<RvRxR}RARRRRRRRRRRRRTRRRRRRbRcRRgRRRRRRRRRRR RRRRRRR R"R#R$R*R1R4R9R<R=R>R?RaR@RAReRfRGRSRVRhR\R_RERaRcRiRgRvRwR}RRRRRRRRyRRRRRRRRRRRRRRRRRRRRRRRRRRRR`(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRns                                      /  $                                                     tNestedScopeMixincBseZdZdZRS(s>Defines initClass() for nested scoping (Python 2.2-compatible)cCs(t|j_t|j_t|j_dS(N(RTRwRtFunctionCodeGeneratorRtClassCodeGeneratorR(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRv s  (RBRCRiRv(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRsRFcBs)eZejZdZdZdZRS(cCsEtjd|j|_tj||_|jt||dS(Ns( Rt PyFlowGraphR&RRt find_futuresRt _ModuleCodeGenerator__super_initR(R;R?((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<s cCs|S(N((R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRsN(RBRCRnR<RR/RR(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRFs  RDcBs/eZejZdZdZdZdZRS(cCs3tjd|j|_|jt||dS(Ns (RRR&Rt$_ExpressionCodeGenerator__super_initR(R;R?((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<#s cCs|S(N((R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyR(sN(( RBRCRnR<RR/RRR(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRDs   REcBs8eZejZdZdZdZdZdZ RS(cCsMtjd|j|_|j|j|t|||jddS(Ns R(RRR&Rt%_InteractiveCodeGenerator__super_initRRR(R;R?((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<2s    cCs|S(N((R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyR9scCs!|j|j|jddS(Nt PRINT_EXPR(RRR(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyR=<sN(( RBRCRnR<RR/RRRR=(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRE+s    tAbstractFunctionCodecBsGeZdZdZdZdZdZdZdZeZ RS(iic CsL||_||_|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 jtn|jr"|j jtn|j|| rH|j|jndS(Ns iRRi(RtmoduleRt lambdaCountRYtgenerateArgListtargnamesRRR&RRt super_initRRRR4RRzRR^tvarargsRRtkwargsRRtgenerateArgUnpack( R;tfuncRRRR*tklassRYRt hasTupleArgR((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<Fs.       !   cCs|jS(N(R(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRcscCs:|jj|js)|jddn|jddS(NRR(RtstartExitBlockRRR/(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRfs  cCsbx[tt|D]G}||}t|tr|jdd|d|j|qqWdS(Nt LOAD_FASTs.%di(RRRjRMRtunpackSequence(R;RRR((s*/usr/lib64/python2.7/compiler/pycodegen.pyRls  cCstdkr%|jdt|n|jdt|x=|D]5}t|trg|j|qB|jd|qBWdS(NiR]R`R(RERRRjRMRR(R;ttupR]((s*/usr/lib64/python2.7/compiler/pycodegen.pyRss  ( RBRCRRR<RRRRt unpackTuple(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRBs     RcBs)eZejZdZejZdZRS(cCs||_|||_|j||||||jj|jj|jj|jj|jjdk r|jj t ndS(N( RRt"_FunctionCodeGenerator__super_initRt setFreeVarsRt setCellVarst get_cell_varst generatorR/RR(R;RRRRR*((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<s  N( RBRCRnR<RR/RRR(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs  RcBs)eZejZdZejZdZRS(cCsu||_|||_|j||d|||jj|jj|jj|jj|jjt dS(Ni( RRt!_GenExprCodeGenerator__super_initRRRRRRR(R;tgexpRRR*((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<s   N( RBRCRnR<RR/RRR(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs  tAbstractClassCodecBs#eZdZdZdZRS(cCs|j|_||_tj|j|jdddd|_|jt|j |j dd}|j j |j |jjt|jr|j|jndS(NRiRiR(RYRRRRR&RRRR4RRzRR^RRRR(R;RRRR((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<s    cCs|jS(N(R(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRscCs+|jj|jd|jddS(Nt LOAD_LOCALSR(RRR(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs  (RBRCR<RR(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs RcBs)eZejZdZejZdZRS(cCs||_|||_|j||||jj|jj|jj|jj|j||j dd|j d|j r|j d|j |j dndS(Nt LOAD_GLOBALRBRCRRi( RRt_ClassCodeGenerator__super_initRRRRRRRRR(R;RRR((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<s     N( RBRCRnR<RR/RRR(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs  cCsg}g}d}xtt|D]}||}t|trT|j|q%t|tr|jt|d||jtj ||d}q%t d|q%W|||fS(s&Generate an arg list marking TupleArgsiiisunexpect argument type:( RRRjtstrtappendRMRtextendRtflattenR3(targlistRtextratcountRR]((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs  cCs#t}t||dd|jS(s5Find the op (DELETE, LOAD, STORE) in an AssTuple treeRi(tOpFinderRR(R_R((s*/usr/lib64/python2.7/compiler/pycodegen.pyR^s RcBs&eZdZdZeZeZRS(cCs d|_dS(N(R/R(R;((s*/usr/lib64/python2.7/compiler/pycodegen.pyR<scCs@|jdkr|j|_n|j|jkr<tdndS(Nsmixed ops in stmt(RR/R7R3(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyRhs(RBRCR<RhR\R(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs  t DelegatorcBs eZdZdZdZRS(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*/usr/lib64/python2.7/compiler/pycodegen.pyR<scCst|j|S(N(RR(R;tattr((s*/usr/lib64/python2.7/compiler/pycodegen.pyt __getattr__s(RBRCRiR<R(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRs  t AugGetattrcBseZRS((RBRC(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRstAugNamecBseZRS((RBRC(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRstAugSlicecBseZRS((RBRC(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRst AugSubscriptcBseZRS((RBRC(((s*/usr/lib64/python2.7/compiler/pycodegen.pyRscCst|j|S(N(twrapperRw(R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyRfst__main__(MRRRKRJRNtsyst cStringIORtcompilerRRRRRRRRtcompiler.constsR R R R R RRRRRRRRRtcompiler.pyassemRt version_infoREtAttributeErrorRRRRRR+R/R#R:R2R1R"RTRmRnRRFRDRERRRRRRR^RRRRRRtGetattrtNametSlicet SubscriptRRfRBtargvtfile(((s*/usr/lib64/python2.7/compiler/pycodegen.pyts     ""(@        + U>