Ñò ú˜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. cCsf|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ƒpt‚t|dƒptd |ƒ‚ndS( Nst_lambda_t formatvaluecSsdS(t((tval((s-/usr/lib/python2.6/site-packages/decorator.pyt4siiÿÿÿÿtnamet signatures%You are decorating a non function: %s(t__name__R t__doc__tdoct __module__tmoduletinspectt isfunctiont formatargspect getargspecR t func_defaultstdefaultst__dict__tcopytdicttNonethasattrtAssertionErrort TypeError(tselftfuncR R RRRtfuncdict((s-/usr/lib/python2.6/site-packages/decorator.pyt__init__)s4     "        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(tFalseRG(((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 RGRR(RIRtfunt 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|ƒpti|ƒpt‚ti|ƒ\}}}}t|ƒ}|o|i|ƒn|o|i|ƒnti||||dd„ƒdd!}td|i d|d|d|i d |i d |i d |i d |id |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(RtismethodRRRtlisttappendRRR RR RRt func_globalst func_closure(Rtregargstvarargst varkwargsRRUR ((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(RRK(twrappertmodeltinfodict((s-/usr/lib/python2.6/site-packages/decorator.pytupdate_wrapper´s     cCsst|tƒo |}n t|ƒ}d|djp td‚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'. t _wrapper_RUs("_wrapper_" is a reserved argument name!s.lambda %(signature)s: _wrapper_(%(signature)s)(t isinstanceRRRtevalRc(R`RaRbR?tfuncopy((s-/usr/lib/python2.6/site-packages/decorator.pyRÀs    (R t__all__tosR$treRRPR9R/tobjectRRRRRRcR(((s-/usr/lib/python2.6/site-packages/decorator.pyts<K  )