{fc@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.pyRvtcCsyXt|dstt|ds-tt|dsBtt|dsWtWn,tk r}d|jj}t|nXdS(s*Verify that class is constructed correctlyRt NameFindert FunctionGentClassGensBad class construction for %sN(thasattrtAssertionErrortgetattrRwRB(R;tmsgtintro((s*/usr/lib64/python2.7/compiler/pycodegen.pyRxscCsO|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(RR/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_RRztpushR^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 decoratorstnodesRtlenRRRRRR4tfinishRtdefaultst _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(RRRRR4RRRRYtbasesRRRR(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_R RR RRR 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_R RR RRR 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_R RR RRRR 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.pytvisitGenExprIfscCs|j}|j||j|j|j|jd||j|jdd|jr|j|j|jddn|jdd|j|dS(NtPOP_JUMP_IF_TRUEt LOAD_GLOBALRt RAISE_VARARGSii(RRRRRRtfail(R;R_R((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAsserts     cCs|j|d}|jr9|j|j|d}n|jr_|j|j|d}n|jr|j|j|d}n|jd|dS(NiiR((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_RR1RtlElsetlastRRttargettnext((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_RR8((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__RiRRR7RRRRt WITH_CLEANUPR(Rt_CodeGenerator__with_countRRRRtvarsR/RRR{RRRRR(R;R_RR8tvaluevar((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   cCsT|j||j}|dkr>|jjt r>d}ntd|jD}tdkr|jd||jd|n|jd|j x|jD]\}}tdkr/|dkrd|_ |jdt |jdkst dS|jd ||j ||j|p(|q|jd |qW|jd dS( Niicss|]\}}|VqdS(N((t.0RYRd((s*/usr/lib64/python2.7/compiler/pycodegen.pys siRRGt*t IMPORT_STARt IMPORT_FROMR(RRMRRIRttupleRVRJRtmodnamet namespaceRRRLR(R;R_RMtfromlistRYRd((s*/usr/lib64/python2.7/compiler/pycodegen.pyRfs*         cCsN|jd}t|dkr%dSx"|dD]}|jd|q0WdS(NRHiR:(RKRR(R;RYteltsR]((s*/usr/lib64/python2.7/compiler/pycodegen.pyRLs cCs0|j|j|jd|j|jdS(NR:(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(NR\t STORE_ATTRR]t DELETE_ATTRswarning: unexpected flags:(RRR7RRRW(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAssAttrs tUNPACK_SEQUENCEcCsSt|dkr.|j|t|jnx|jD]}|j|q8WdS(NR](tfindOpRRRR(R;R_RR((s*/usr/lib64/python2.7/compiler/pycodegen.pyt_visitAssSequencesicCs|j|ddS(Nt UNPACK_TUPLE(Rd(R;R_((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAssTuplescCs|j|ddS(Nt UNPACK_LIST(Rd(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(NRiRj(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(NRiRR:RjRR_(RRRRRW(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( NRiiRjiiRitROT_FOURRsSTORE_SLICE+%d(t visitSlicetlowertupperR(R;R_R6tslice((s*/usr/lib64/python2.7/compiler/pycodegen.pyt visitAugSlices         cCsL|dkr|j|dn)|dkrH|jd|jdndS(NRiiRjRt 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+%dR\sSTORE_SLICE+%dR]sDELETE_SLICE+%ds weird slice(RRRRRR7(R;R_taug_flagR((s*/usr/lib64/python2.7/compiler/pycodegen.pyR~ms,       cCs|j|jx|jD]}|j|qWt|jdkrb|jdt|jn|r{|jddn|jdkr|jdn>|jdkr|jdn|jd kr|jd ndS( NiRRiRt BINARY_SUBSCRR\RR]t 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 RRRRRR R"R$R%R*R/R6R9R>RARBRCRDRaRERFReRfRLRXR[RhRaRdRJRfRhRnRlR{R|RRRRRRRRR~RRRRRRRRRRRRRRRRRRRRRRRRRRRR`(((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.pyRB<sN(( RBRCRnR<RR/RRRRB(((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(RRRjRRRtunpackSequence(R;RRR((s*/usr/lib64/python2.7/compiler/pycodegen.pyRls  cCstdkr%|jdt|n|jdt|x=|D]5}t|trg|j|qB|jd|qBWdS(NiRbReR(RJRRRjRRRR(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(NR'RBRCRRi( 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:( RRRjtstrtappendRRRtextendRtflattenR3(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.pyRcs 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<RhRaR(((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.pyRkst__main__(MRRRKRJRNtsyst cStringIORtcompilerRRRRRRRRtcompiler.constsR R R R R RRRRRRRRRtcompiler.pyassemRt version_infoRJtAttributeErrorRRRRRR+R/R#R:R2R1R"RTRmRnRRFRDRERRRRRRRcRRRRRRtGetattrtNametSlicet SubscriptR RkRBtargvtfile(((s*/usr/lib64/python2.7/compiler/pycodegen.pyts     ""(@        + U>