ó ¿œ^c@s±dZddlZddlZddlZddlZdeejjdƒZd„Z dfd„ƒYZ ej d„Z d „Z d „Zed kr­eejdƒndS( s'Usage: unparse.py iÿÿÿÿNt1eicCsZt|ƒ}y|t|ƒƒWntk r3n#Xx|D]}|ƒ||ƒq;WdS(s<Call f on each item in seq, calling inter() in between. N(titertnextt StopIteration(tintertftseqtx((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt interleave s   tUnparsercBseZdZejd„Zdd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„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/„Z2id0d16d2d36d4d56d6d76Z3d8„Z4i d4d96d6d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6Z5dO„Z6i dPdQ6dRdS6dTdU6dVdW6dXdY6dZd[6d\d]6d^d_6d`da6dbdc6Z7dd„Z8idee9j:6dfe9j;6Z<dg„Z=dh„Z>di„Z?dj„Z@dk„ZAdl„ZBdm„ZCdn„ZDdo„ZEdp„ZFdq„ZGdr„ZHRS(ssŽMethods in this class recursively traverse an AST and output source code for the abstract syntax; original formatting is disregarded. cCsI||_g|_d|_|j|ƒ|jjdƒ|jjƒdS(sTUnparser(tree, file=sys.stdout) -> None. Print the source for tree to file.itN(Rtfuture_importst_indenttdispatchtwritetflush(tselfttreetfile((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt__init__s     R cCs#|jjdd|j|ƒdS(sBIndent a piece of text, according to the current indentation levels s N(RRR (Rttext((s+/usr/lib64/python2.7/Demo/parser/unparse.pytfill'scCs|jj|ƒdS(s+Append a piece of text to the current line.N(RR(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyR+scCs |jdƒ|jd7_dS(s(Print ':', and increase the indentation.t:iN(RR (R((s+/usr/lib64/python2.7/Demo/parser/unparse.pytenter/s cCs|jd8_dS(sDecrease the indentation level.iN(R (R((s+/usr/lib64/python2.7/Demo/parser/unparse.pytleave4scCsXt|tƒr1x|D]}|j|ƒqWdSt|d|jjƒ}||ƒdS(s:Dispatcher function, dispatching tree type T to method _T.Nt_(t isinstancetlistR tgetattrt __class__t__name__(RRtttmeth((s+/usr/lib64/python2.7/Demo/parser/unparse.pyR 8s  cCs%x|jD]}|j|ƒq WdS(N(tbodyR (RRtstmt((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_ModuleIscCs|jƒ|j|jƒdS(N(RR tvalue(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_ExprNs cs0ˆjdƒt‡fd†ˆj|jƒdS(Nsimport cs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pytTR (RRR tnames(RR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_ImportRs cs¥|jr8|jdkr8ˆjjd„|jDƒƒnˆjdƒˆjd|jƒ|jruˆj|jƒnˆjdƒt‡fd†ˆj|jƒdS(Nt __future__css|]}|jVqdS(N(tname(t.0tn((s+/usr/lib64/python2.7/Demo/parser/unparse.pys Yssfrom t.s import cs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&`R ( tmoduleR textendR'RRtlevelRR (RR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt _ImportFromVs    cCsL|jƒx+|jD] }|j|ƒ|jdƒqW|j|jƒdS(Ns = (RttargetsR RR$(RRttarget((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Assignbs   cCsS|jƒ|j|jƒ|jd|j|jjjdƒ|j|jƒdS(Nt s= ( RR R3RtbinoptopRRR$(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _AugAssignis %cCs:|jdƒ|jr6|jdƒ|j|jƒndS(NtreturnR5(RR$RR (RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Returnos   cCs|jdƒdS(Ntpass(R(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_PassuscCs|jdƒdS(Ntbreak(R(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_BreakxscCs|jdƒdS(Ntcontinue(R(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _Continue{scs0ˆjdƒt‡fd†ˆj|jƒdS(Nsdel cs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&€R (RRR R2(RR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Delete~s cCsJ|jdƒ|j|jƒ|jrF|jdƒ|j|jƒndS(Nsassert s, (RR ttesttmsgR(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Assert‚s    cCss|jdƒ|j|jƒ|jrF|jdƒ|j|jƒn|jro|jdƒ|j|jƒndS(Nsexec s in s, (RR R!tglobalsRtlocals(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Exec‰s     cCsœ|jdƒt}|jrB|jdƒ|j|jƒt}nx:|jD]/}|rh|jdƒnt}|j|ƒqLW|js˜|jdƒndS(Nsprint s>>s, t,(RtFalsetdestRR tTruetvaluestnl(RRtdo_commate((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Print“s     cs0ˆjdƒt‡fd†ˆj|jƒdS(Nsglobal cs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&£R (RRRR'(RR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Global¡s cCsT|jdƒ|jdƒ|jrC|jdƒ|j|jƒn|jdƒdS(Nt(tyieldR5t)(RR$R (RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Yield¥s     cCs|jdƒ|jr)|j|jƒn|jrR|jdƒ|j|jƒn|jr{|jdƒ|j|jƒndS(Nsraise s, (RttypeR tinstRttback(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Raise­s      cCs“|jdƒ|jƒ|j|jƒ|jƒx|jD]}|j|ƒq;W|jr|jdƒ|jƒ|j|jƒ|jƒndS(Nttrytelse(RRR R!Rthandlerstorelse(RRtex((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _TryExcept¸s      cCs§t|jƒdkrAt|jdtjƒrA|j|jƒn1|jdƒ|jƒ|j|jƒ|jƒ|jdƒ|jƒ|j|j ƒ|jƒdS(NiiRZtfinally( tlenR!Rtastt TryExceptR RRRt finalbody(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _TryFinallyÆs.     cCs‡|jdƒ|jr6|jdƒ|j|jƒn|jr_|jdƒ|j|jƒn|jƒ|j|jƒ|jƒdS(NtexceptR5s as (RRVRR R*RR!R(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_ExceptHandlerÕs      cCsË|jdƒx+|jD] }|jdƒ|j|ƒqW|jd|jƒ|jr£|jdƒx+|jD] }|j|ƒ|jdƒqoW|jdƒn|jƒ|j|jƒ|jƒdS(Ns t@sclass RRs, RT( Rtdecorator_listRR R*tbasesRR!R(RRtdecota((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _ClassDefás      cCs˜|jdƒx+|jD] }|jdƒ|j|ƒqW|jd|jdƒ|j|jƒ|jdƒ|jƒ|j|jƒ|jƒdS(Ns Rhsdef RRRT( RRiRR R*targsRR!R(RRRk((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _FunctionDefñs    cCsŸ|jdƒ|j|jƒ|jdƒ|j|jƒ|jƒ|j|jƒ|jƒ|jr›|jdƒ|jƒ|j|jƒ|jƒndS(Nsfor s in R[( RR R3RRRR!RR](RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Forýs       cCs|jdƒ|j|jƒ|jƒ|j|jƒ|jƒx‰|jrÌt|jƒdkrÌt|jdt j ƒrÌ|jd}|jdƒ|j|jƒ|jƒ|j|jƒ|jƒqDW|jr |jdƒ|jƒ|j|jƒ|jƒndS(Nsif iiselif R[( RR RBRR!RR]RaRRbtIf(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_If s$   !      cCs‚|jdƒ|j|jƒ|jƒ|j|jƒ|jƒ|jr~|jdƒ|jƒ|j|jƒ|jƒndS(Nswhile R[(RR RBRR!RR](RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_While!s      cCsn|jdƒ|j|jƒ|jrF|jdƒ|j|jƒn|jƒ|j|jƒ|jƒdS(Nswith s as (RR t context_exprt optional_varsRRR!R(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_With-s    cCs¡d|jkr(|jt|jƒƒnut|jtƒrW|jdt|jƒƒnFt|jtƒr‹|jt|jƒjdƒƒntst dƒ‚dS(Ntunicode_literalstbtusshouldn't get here( R RtreprtsRtstrtunicodetlstripRItAssertionError(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Str8s"cCs|j|jƒdS(N(Rtid(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_NameEscCs.|jdƒ|j|jƒ|jdƒdS(Nt`(RR R$(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_ReprHs cCsjt|jƒ}|jdƒr.|jdƒn|j|jdtƒƒ|jdƒrf|jdƒndS(Nt-RRtinfRT(RzR,t startswithRtreplacetINFSTR(RRtrepr_n((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_NumMs cs=ˆjdƒt‡fd†ˆj|jƒˆjdƒdS(Nt[cs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&YR t](RRR telts(RR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_ListWs cCsO|jdƒ|j|jƒx|jD]}|j|ƒq'W|jdƒdS(NRŒR(RR teltt generators(RRtgen((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _ListComp\s  cCsO|jdƒ|j|jƒx|jD]}|j|ƒq'W|jdƒdS(NRRRT(RR RR‘(RRR’((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _GeneratorExpcs  cCsO|jdƒ|j|jƒx|jD]}|j|ƒq'W|jdƒdS(Nt{t}(RR RR‘(RRR’((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_SetCompjs  cCsl|jdƒ|j|jƒ|jdƒ|j|jƒx|jD]}|j|ƒqDW|jdƒdS(NR•s: R–(RR tkeyR$R‘(RRR’((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _DictCompqs  cCsl|jdƒ|j|jƒ|jdƒ|j|jƒx+|jD] }|jdƒ|j|ƒqDWdS(Ns for s in s if (RR R3Rtifs(RRt if_clause((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_comprehensionzs   cCsh|jdƒ|j|jƒ|jdƒ|j|jƒ|jdƒ|j|jƒ|jdƒdS(NRRs if s else RT(RR R!RBR](RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_IfExpƒs   csL|jst‚ˆjdƒt‡fd†ˆj|jƒˆjdƒdS(NR•cs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&R R–(RŽRRRR (RR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_SetŒs csUˆjdƒ‡fd†}t‡fd†|t|j|jƒƒˆjdƒdS(NR•cs7|\}}ˆj|ƒˆjdƒˆj|ƒdS(Ns: (R R(tpairtktv(R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyt write_pair”s   cs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&™R R–(RRtziptkeysRL(RRR¢((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Dict’s (cs{ˆjdƒt|jƒdkrK|j\}ˆj|ƒˆjdƒnt‡fd†ˆj|jƒˆjdƒdS(NRRiRHcs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&£R RT(RRaRŽR R(RRR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Tupleœs   t~tInverttnottNott+tUAddR…tUSubcCs¯|jdƒ|j|j|jjjƒ|jdƒt|jtjƒrŽt|jtj ƒrŽ|jdƒ|j |jƒ|jdƒn|j |jƒ|jdƒdS(NRRR5RT( RtunopR7RRRRbR­toperandtNumR (RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_UnaryOp§s  * tAddtSubt*tMultt/tDivt%tMods<>tRShiftt|tBitOrt^tBitXort&tBitAnds//tFloorDivs**tPowcCsc|jdƒ|j|jƒ|jd|j|jjjdƒ|j|jƒ|jdƒdS(NRRR5RT(RR tleftR6R7RRtright(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_BinOp»s  %s==tEqs!=tNotEqttGts>=tGtEtistIssis nottIsNottintInsnot intNotIncCsƒ|jdƒ|j|jƒxRt|j|jƒD];\}}|jd|j|jjdƒ|j|ƒq3W|jdƒdS(NRRR5RT( RR RÄR£topst comparatorstcmpopsRR(RRtoRO((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_CompareÄs  ""tandtorcsWˆjdƒdˆj|jj‰t‡‡fd†ˆj|jƒˆjdƒdS(NRRs %s cs ˆjˆƒS(N(R((R{R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR&ÐR RT(RtboolopsR7RRR RL(RR((R{Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt_BoolOpÍs "cCsk|j|jƒt|jtjƒrJt|jjtƒrJ|jdƒn|jdƒ|j|jƒdS(NR5R-( R R$RRbR°R,tintRtattr(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _AttributeÓs * cCs8|j|jƒ|jdƒt}x:|jD]/}|rI|jdƒnt}|j|ƒq-Wx:|jD]/}|r†|jdƒnt}|j|ƒqjW|jrâ|r¼|jdƒnt}|jdƒ|j|jƒn|jr'|r|jdƒnt}|jdƒ|j|jƒn|jdƒdS(NRRs, R´s**RT( R tfuncRRIRnRKtkeywordststarargstkwargs(RRtcommaRO((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_CallÝs4     cCs>|j|jƒ|jdƒ|j|jƒ|jdƒdS(NRŒR(R R$Rtslice(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _Subscriptõs cCs|jdƒdS(Ns...(R(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _EllipsisüscCs|j|jƒdS(N(R R$(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_IndexÿscCsr|jr|j|jƒn|jdƒ|jrE|j|jƒn|jrn|jdƒ|j|jƒndS(NR(tlowerR Rtuppertstep(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Slices     cs#t‡fd†ˆj|jƒdS(Ncs ˆjdƒS(Ns, (R((R(s+/usr/lib64/python2.7/Demo/parser/unparse.pyR& R (RR tdims(RR((Rs+/usr/lib64/python2.7/Demo/parser/unparse.pyt _ExtSlice scCs't}dgt|jƒt|jƒ|j}xot|j|ƒD][\}}|r^t}n |jdƒ|j|ƒf|rC|jdƒ|j|ƒqCqCW|j rç|rºt}n |jdƒ|jdƒ|j|j ƒn|j r#|rÿt}n |jdƒ|jd|j ƒndS(Ns, t=R´s**( RKtNoneRaRntdefaultsR£RIRR tvarargtkwarg(RRtfirstRóRltd((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt _argumentss**          cCs1|j|jƒ|jdƒ|j|jƒdS(NRñ(RtargR R$(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_keyword)s cCsX|jdƒ|jdƒ|j|jƒ|jdƒ|j|jƒ|jdƒdS(NRRslambda s: RT(RR RnR!(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_Lambda.s    cCs4|j|jƒ|jr0|jd|jƒndS(Ns as (RR*tasname(RR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt_alias6s (IRt __module__t__doc__tsyststdoutRRRRRR R#R%R(R1R4R8R:R<R>R@RARDRGRPRQRURYR_ReRgRmRoRpRrRsRvR€R‚R„R‹RR“R”R—R™RœRRžR¥R¦R®R±R6RÆR×RÙRbtAndtOrRÜRÝRàRæRèRéRêRîRðRøRúRûRý(((s+/usr/lib64/python2.7/Demo/parser/unparse.pyR sŠ                                " &# -          cCsMt|dƒ}|jƒ}WdQXt||dtjƒ}t||ƒdS(Ntrtexec(topentreadtcompileRbt PyCF_ONLY_ASTR (tfilenametoutputtpyfiletsourceR((s+/usr/lib64/python2.7/Demo/parser/unparse.pyt roundtrip;scCsy5gtj|ƒD]}|jdƒr|^q}Wn%tk r\tjjd|ƒn¦Xx¢|D]š}tjj||ƒ}tjj |ƒrßt j ƒ}d|GHyt ||ƒWqþt k rÛ}dt|ƒGHqþXqdtjj|ƒrdt|ƒqdqdWdS(Ns.pysDirectory not readable: %ss Testing %ss$ Failed to compile, exception is %s(tostlistdirtendswithtOSErrorRtstderrRtpathtjointisfilet cStringIOtStringIORt ExceptionRztisdirttestdir(RlR,R'tfullnameR RO((s+/usr/lib64/python2.7/Demo/parser/unparse.pyRCs5    cCsQ|ddkr2x:|dD]}t|ƒqWnx|D]}t|ƒq9WdS(Nis --testdiri(RR(RnRl((s+/usr/lib64/python2.7/Demo/parser/unparse.pytmainUs  t__main__(RÿRRbRRRzt float_infot max_10_expR‰RR RRRRRtargv(((s+/usr/lib64/python2.7/Demo/parser/unparse.pyts     ÿÿ%