ó 9(Zc@sÅdZddlZejddkZejddkZerhefZddlZeedƒZ [ne fZddd„Z ddl m Z dd lmZmZmZdd lmZdd lmZmZydd lmZWnek rùnXd dlmZmZmZmZdefd„ƒYZdefd„ƒYZdefd„ƒYZ defd„ƒYZ!de"fd„ƒYZ#de#fd„ƒYZ$e$Z%dddd„Z&d„Z'dS(soThis module implements decorators for implementing other decorators as well as some commonly used decorators. iÿÿÿÿNiiitexeccBsc|dkrBejdƒ}|j}|dkr<|j}n~n|dkrW|}nddUdS(sExecute code in a namespace.isexec _code_ in _globs_, _locs_N(tNonetsyst _getframet f_globalstf_locals(t_code_t_globs_t_locs_tframe((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pytexec_s      (tpartial(tismethodtisclasst formatargspec(t namedtuple(tLocktRLock(t signaturei(tFunctionWrappertBoundFunctionWrappert ObjectProxytCallableObjectProxyt_AdapterFunctionCodecBs\eZd„Zed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZRS(cCs#tt|ƒj|ƒ||_dS(N(tsuperRt__init__t_self_adapter_code(tselft wrapped_codet adapter_code((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR6scCs |jjS(N(Rt co_argcount(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR:scCs |jjS(N(Rtco_code(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR>scCs |jjS(N(Rtco_flags(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR BscCs |jjS(N(Rtco_kwonlyargcount(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR!FscCs |jjS(N(Rt co_varnames(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR"Js( t__name__t __module__RtpropertyRRR R!R"(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR4s  t_AdapterFunctionSurrogatecBsbeZd„Zed„ƒZed„ƒZed„ƒZed„ƒZer`eZ eZ nRS(cCs#tt|ƒj|ƒ||_dS(N(RR&Rt _self_adapter(Rtwrappedtadapter((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyRPscCst|jj|jjƒS(N(Rt __wrapped__t__code__R'(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR+Ts cCs |jjS(N(R't __defaults__(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR,YscCs |jjS(N(R't__kwdefaults__(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR-]scCs*dtƒkr|jjSt|jƒSdS(NR(tglobalsR't __signature__R(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR/as ( R#R$RR%R+R,R-R/tPY2t func_codet func_defaults(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR&Ns  t_BoundAdapterWrappercBs&eZed„ƒZer$eZnRS(cCst|jj|jjƒS(N(R&R*t__func__t _self_parentR'(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR4ss (R#R$R%R4R0tim_func(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR3qstAdapterWrappercBsheZeZd„Zed„ƒZed„ƒZed„ƒZe rWeZ eZ ned„ƒZ RS(cOsJ|jdƒ}tt|ƒj||Žt|j|ƒ|_||_dS(NR)(tpopRR7RR&R*t_self_surrogateR'(RtargstkwargsR)((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyRs cCs |jjS(N(R9R+(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR+†scCs |jjS(N(R9R,(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR,ŠscCs |jjS(N(R9R-(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR-ŽscCs |jjS(N(R9R/(R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR/–s( R#R$R3t__bound_function_wrapper__RR%R+R,R-R0R1R2R/(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR7{s  tAdapterFactorycBseZd„ZRS(cCs tƒ‚dS(N(tNotImplementedError(RR(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt__call__›s(R#R$R?(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR=šstDelegatedAdapterFactorycBseZd„Zd„ZRS(cCs tt|ƒjƒ||_dS(N(RR@Rtfactory(RRA((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyRŸscCs |j|ƒS(N(RA(RR(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR?¢s(R#R$RR?(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR@žs csZˆdk r@ddd„‰‡‡‡‡fd†}ˆˆ|ƒSttdˆdˆƒSdS(Nc Ss²|r™t|tƒr$||ƒ}nt|ƒszi}t|tƒsTt|Œ}ntdj|ƒ||ƒ|d}ntd|d|d|d|ƒStd|d|d|ƒS(Nsdef adapter{0}: passR)R(twrappertenabled( t isinstanceR=tcallablet string_typesRR tformatR7R(R(RBRCR)tns((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt_buildÈs   csì|dkr>tˆƒr>| r>‡‡‡‡‡fd†}|S|d}ˆ}t|ƒtkrs|sj|Sd}n|dkr tˆƒr—ˆƒ}qÙˆ}n9t|ƒrÁˆjd|ƒ}nˆj|t|ƒƒ}ˆ|||ˆƒS(NcsJˆ}t|ƒtkr+|s"|Sd}nˆˆ}ˆ|||ˆƒS(N(ttypetboolR(ttarget_wrappedt_enabledttarget_wrapper(RIR)RCR;R((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt_captureûs   i(RR RJRKt__get__(R(tinstanceR:R;RORLRMRN(RIR)RCRB(R;R(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt_wrapperás"       RCR)(RR t decorator(RBRCR)RR((RIR)RCRBs//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyRS®s  ­ cs©t|dƒrbt|dƒrb|‰t‡fd†ƒ}dtf‡fd†ƒY}|d|ƒSd„‰‡fd†}d tf‡fd †ƒY}|d|d |ƒS( Ntacquiretreleasecsˆ|||ŽSWdQXdS(N((R(RQR:R;(tlock(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt _synchronized²st_PartialDecoratorcs&eZ‡fd†Z‡fd†ZRS(csˆjƒˆS(N(RT(R(RV(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt __enter__¼s csˆjƒdS(N(RU(RR:(RV(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt__exit__Às(R#R$RYRZ((RV(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyRXºsR(cSs“t|ƒjddƒ}|dkrttƒjdtƒƒ}|Et|ƒjddƒ}|dkr†tƒ}t|d|ƒnWdQXn|S(Nt_synchronized_lockt_synchronized_meta_lock(tvarstgetRt synchronizedt setdefaultRRtsetattr(tcontextRVt meta_lock((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR[Ës   cs*ˆ|p |ƒ|||ŽSWdQXdS(N((R(RQR:R;(R[(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyt_synchronized_wrapperîst_FinalDecoratorcs eZ‡fd†Zd„ZRS(cs&ˆ|jƒ|_|jjƒ|jS(N(R*t _self_lockRT(R(R[(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyRYøs cWs|jjƒdS(N(RfRU(RR:((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyRZýs(R#R$RYRZ((R[(s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyReösRB(thasattrRSRR(R(RWRXRdRe((R[RVs//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyR_¢s  # ((t__doc__Rt version_infoR0tPY3tstrRFtbuiltinstgetattrR t basestringRt functoolsR tinspectR R Rt collectionsRt threadingRRRt ImportErrortwrappersRRRRRR&R3R7tobjectR=R@tadapter_factoryRSR_(((s//tmp/pip-build-wDUJoH/wrapt/wrapt/decorators.pyts8      " #  ô