ó ‰ÂPc@sVdZdZdddgZddlZddlZddlZejdkrjddlmZd „Znd e fd „ƒYZd „Zej d ƒZ de fd„ƒYZ dd„Zd„Zy2ddlmZedefedeƒƒZWnNek rEddlmZd„ZedefededeƒƒZnXeeƒZdS(sT Decorator module, see http://pypi.python.org/pypi/decorator for the documentation. s3.4.0t decoratort FunctionMakertcontextmanageriÿÿÿÿNt3(tgetfullargspeccCs|jS(N(t__init__(tcls((s-/usr/lib/python2.7/site-packages/decorator.pytget_init*sRcBs eZdZd„Zd„ZRS(s?A quick and dirty replacement for getfullargspec for Python 2.XcCs=tj|ƒ\|_|_|_|_g|_d|_dS(N( tinspectt getargspectargstvarargstvarkwtdefaultst kwonlyargstNonetkwonlydefaults(tselftf((s-/usr/lib/python2.7/site-packages/decorator.pyR/s' ccs$|jV|jV|jV|jVdS(N(R R R R (R((s-/usr/lib/python2.7/site-packages/decorator.pyt__iter__4s(t__name__t __module__t__doc__RR(((s-/usr/lib/python2.7/site-packages/decorator.pyR-s cCs |jjS(N(Rtim_func(R((s-/usr/lib/python2.7/site-packages/decorator.pyR9ss\s*def\s*([_\w][_\w\d]*)\s*\(cBs_eZdZdddddddd„Zd„Zded„Zeddde d„ƒZ RS(s´ An object with the ability to create functions with a given signature. It has attributes name, doc, module, signature, defaults, dict and methods update and make. cCsÆ||_|r.|j|_|jdkr6d|_n|j|_|j|_tj|ƒr.t |ƒ}t |diƒ|_ x'dD]} t || t || ƒƒq…Wx1t |jƒD] \} } t |d | | ƒq¸Wtjd krtjd d „|Œdd!|_|_nÿt|jƒ} t|jƒ} |jri| jd|jƒ| jd|jƒn|jr‚| jdƒnx9|jD].} | jd| ƒ| jd| | fƒqŒW|jrò| jd|jƒ| jd|jƒndj| ƒ|_dj| ƒ|_|jjƒ|_q.n|r@||_n|dk rX||_n|rj||_n|r|||_n|rŽ||_n|r ||_nt|dƒsÂtd|ƒ‚ndS(Nst_lambda_t__annotations__R R R R RRsarg%dRt formatvaluecSsdS(Nt((tval((s-/usr/lib/python2.7/site-packages/decorator.pytZsiiÿÿÿÿt*s%s=Nones%s=%ss**s, t signatures%You are decorating a non function: %s(sargssvarargssvarkwsdefaultss kwonlyargsskwonlydefaults( tshortsignatureRtnameRtdocRtmoduleRt isfunctionRtgetattrt annotationstsetattrt enumerateR tsystversiont formatargspecRtlistR tappendRR tjoint__dict__tcopytdictRR thasattrt TypeError(RtfuncR!RR R"R#tfuncdicttargspectatitargtallargst allshortargs((s-/usr/lib/python2.7/site-packages/decorator.pyREs`        #          cKs¼|j|_t|dd ƒ|_t|diƒ|_t|dd ƒ|_t|dd ƒ|_t|dd ƒ|_t j dƒj j ddƒ}t|d |ƒ|_ |jj|ƒd S( s2Update the signature of func with the data in selfR"R1R RR&iRt?R#N((R!RR%RRR/t func_defaultst__kwdefaults__RR)t _getframet f_globalstgetRtupdate(RR4tkwt callermodule((s-/usr/lib/python2.7/site-packages/decorator.pyRB~s c Js\|e|ƒ}|pi}ej|ƒ}|d krJed|ƒ‚n|jdƒ}e|gg|jjdƒD]}|j dƒ^quƒ} x3| D]+} | dkr›e d| |fƒ‚q›q›W|j dƒsæ|d7}nye |d d ƒ} | |UWn$e jd IJe j|IJ‚nX||} |rH||d tsinglesError in generated code:t __source__N(s_func_RG(tvarstDEFtmatchRt SyntaxErrortgrouptsetR tsplittstript NameErrortendswithtcompileR)tstderrRB( Rt src_templtevaldictt addsourcetattrstsrctmoR!R9tnamestntcodeR4((s-/usr/lib/python2.7/site-packages/decorator.pytmakeŠs2   /        cKs¦t|tƒr@|jƒjddƒ\} } | d } d} nd} d} |} || | | |||ƒ} djd„|jƒDƒƒ}| jd||||S(sú Create a function from the strings name, signature and body. evaldict is the evaluation dictionary. If addsource is true an attribute __source__ is added to the result. The attributes attrs are added, if any. t(iiÿÿÿÿs css|]}d|VqdS(s N((t.0tline((s-/usr/lib/python2.7/site-packages/decorator.pys ¹ssdef %(name)s(%(signature)s): N(t isinstancetstrRQRPRR.t splitlinesR_(RtobjtbodyRWR R"R#RXRYR!trestRR4Rtibody((s-/usr/lib/python2.7/site-packages/decorator.pytcreate§s    N( RRRRRRBtFalseR_t classmethodtTrueRj(((s-/usr/lib/python2.7/site-packages/decorator.pyR?s 8 c Cs–|dk rN|jjƒ}||d<||dRiRs%s(%s)sreturn decorator(_call_, %s)R"R#N(Rt func_globalsR0RRjRtisclassRtlowerRRR R$Rt __class__t__call__RRR(tcallerR4RWR!t callerfuncR"tfun((s-/usr/lib/python2.7/site-packages/decorator.pyR½s>           cCs(tj|dtd|d|ƒd|ƒS(sContext manager decorators.with _self_: return _func_(%(shortsignature)s)t_self_RFRo(RRjR1(RR4((s-/usr/lib/python2.7/site-packages/decorator.pyRtæs(t_GeneratorContextManagertContextManagerRt(tGeneratorContextManagercOstj||||ŽƒS(N(R{R(RRR7tk((s-/usr/lib/python2.7/site-packages/decorator.pyRõsR(Rt __version__t__all__R)treRR*RRtobjectRTRKRRRRtt contextlibRyttypeR1Rzt ImportErrorR{RR(((s-/usr/lib/python2.7/site-packages/decorator.pyt!s.$  ~ )