Ñò ú˜Ic@sËdZdddddgZddkZddkZddkZddkZddkZeidƒZde fd „ƒYZ dd „Z e d „ƒZ e d „ƒZe dd „ƒZe d„ƒZdS(sT Decorator module, see http://pypi.python.org/pypi/decorator for the documentation. t decoratort FunctionMakert deprecatedtgetinfot new_wrapperiÿÿÿÿNs\s*def\s*([_\w][_\w\d]*)\s*\(cBsDeZdZdddddddd„Zd„Zded„ZRS(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. cCsO|o¢|i|_|idjo d|_n|i|_|i|_ti|ƒoMtidd„ti |ƒŒdd!|_ |i |_ |i iƒ|_q©n|o ||_n|dj o ||_ n|o ||_ n|o ||_n|o ||_n|o ||_nt|dƒptd|ƒ‚ndS( Nst_lambda_t formatvaluecSsdS(t((tval((s-/usr/lib/python2.6/site-packages/decorator.pyt4siiÿÿÿÿt signatures%You are decorating a non function: %s(t__name__tnamet__doc__tdoct __module__tmoduletinspectt isfunctiont formatargspect getargspecR t func_defaultstdefaultst__dict__tcopytdicttNonethasattrt TypeError(tselftfuncR R RRRtfuncdict((s-/usr/lib/python2.6/site-packages/decorator.pyt__init__)s2     "        cKs’|i|_t|ddƒ|_t|dhƒ|_t|ddƒ|_tidƒi i ddƒ}t|d|ƒ|_ |ii |ƒdS( s2Update the signature of func with the data in selfRRRiR t?RN( R R tgetattrRR RRtsyst _getframet f_globalstgetRtupdate(RRtkwt callermodule((s-/usr/lib/python2.6/site-packages/decorator.pyR'Hs c Jsy|e|ƒ}|ph}ei|ƒ}|d joed|ƒ‚n|idƒ}e|gg}|iidƒD]} || i dƒq|~ƒ} xA|i ƒD]3\} } | | joe d| |fƒ‚q¬q¬W|i dƒp|d7}nye |ddƒ} | |UWn$eid IJei|IJ‚nX||}|o||d tsinglesError in generated code:t __source__N(tvarstDEFtmatchRt SyntaxErrortgrouptsetR tsplittstript iteritemst NameErrortendswithtcompileR#tstderrR'(Rt src_templtevaldictt addsourcetattrstsrctmoR t_[1]targtreserved_namestntvtcodeR((s-/usr/lib/python2.6/site-packages/decorator.pytmakeRs4   :      N(R RR RR R'tFalseRF(((s-/usr/lib/python2.6/site-packages/decorator.pyR#s   cCs§|djo_t|ƒ}ti|ƒdd}d|i||f}|i|td|dtƒd|ƒSt|ƒ}d}|i|td|d|ƒd|ƒSdS( s‰ decorator(caller) converts a caller function into a decorator; decorator(caller, func) decorates a function using a caller. is%def %s(%s): return _call_(caller, %s)tcallert_call_t undecoratedsEdef %(name)s(%(signature)s): return _call_(_func_, %(signature)s)t_func_N(RRRRR RFRR(RHRtfunt first_argR>((s-/usr/lib/python2.6/site-packages/decorator.pyRns   cOs*tid|itddƒ|||ŽS(s$A decorator for deprecated functionsscCalling the deprecated function %r Downgrade to decorator 2.3 if you want to use this functionalityt stackleveli(twarningstwarnR tDeprecationWarning(RtargsR(((s-/usr/lib/python2.6/site-packages/decorator.pyR‚scCsÑti|ƒ\}}}}t|ƒ}|o|i|ƒn|o|i|ƒnti||||dd„ƒdd!}td|id|d|d|id |id |i d |i d |i d |i ƒ S(so Returns an info dictionary containing: - name (the name of the function : str) - argnames (the names of the arguments : list) - defaults (the values of the default arguments : tuple) - signature (the signature : str) - doc (the docstring : str) - module (the module name : str) - dict (the function __dict__ : str) >>> def f(self, x=1, y=2, *args, **kw): pass >>> info = getinfo(f) >>> info["name"] 'f' >>> info["argnames"] ['self', 'x', 'y', 'args', 'kw'] >>> info["defaults"] (1, 2) >>> info["signature"] 'self, x, y, *args, **kw' RcSsdS(R((tvalue((s-/usr/lib/python2.6/site-packages/decorator.pyR ®siiÿÿÿÿR targnamesR RRRRtglobalstclosure( RRtlisttappendRRR RR RRt func_globalst func_closure(Rtregargstvarargst varkwargsRRTR ((s-/usr/lib/python2.6/site-packages/decorator.pyR‹s cCsh|p t|ƒ}|d|_|d|_|d|_|ii|dƒ|d|_||_|S(s*A replacement for functools.update_wrapperR RRRR(RR R RRR'RRJ(twrappertmodeltinfodict((s-/usr/lib/python2.6/site-packages/decorator.pytupdate_wrapper´s     cCsXt|tƒo |}n t|ƒ}d|}t|td|ƒƒ}t|||ƒS(sB An improvement over functools.update_wrapper. The wrapper is a generic callable object. It works by generating a copy of the wrapper with the right signature and by updating the copy, not the original. Moreovoer, 'model' can be a dictionary with keys 'name', 'doc', 'module', 'dict', 'defaults'. s.lambda %(signature)s: _wrapper_(%(signature)s)t _wrapper_(t isinstanceRRtevalRa(R^R_R`R>tfuncopy((s-/usr/lib/python2.6/site-packages/decorator.pyRÀs    (R t__all__tosR#treRROR8R.tobjectRRRRRRaR(((s-/usr/lib/python2.6/site-packages/decorator.pyts<K  )