+
    THis                         R t ^ RIt^ RIHtHt ^ RIHt . ROt ! R R4      t ! R R4      t	R	 t
 ! R
 R4      tRR ltRR ltR# )z7
passlib.utils.decor -- helper decorators & properties
N)update_wrapperwraps)warnclasspropertyhybrid_methodmemoized_propertyc                   0   a  ] tR t^t o RtR tR tRtV tR# )r   zjFunction decorator which acts like a combination of classmethod+property (limited to read-only properties)c                    Wn         R # N__func__selffuncs   &&5/usr/lib/python3/dist-packages/passlib/utils/decor.py__init__classproperty.__init__   s        c                $    V P                  V4      # r
   r   r   objclss   &&&r   __get__classproperty.__get__   s    }}S!!r   r   N	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s     t" "r   c                   0   a  ] tR t^t o RtR tR tRtV tR# )r   zu
decorator which invokes function with class if called as class method,
and with object if called at instance level.
c                (    Wn         \        W4       R # r
   )r   r   r   s   &&r   r   hybrid_method.__init__$   s    	t"r   c                P    Vf   Tp\         P                  ! V P                  V4      # r
   )types
MethodTyper   r   s   &&&r   r   hybrid_method.__get__)   s#    ;C		3//r   )r   Nr   r"   s   @r   r   r      s     
#
0 0r   c                P   a a / o\        S 4      VV 3R l4       pV3R lpW!n        V# )z
decorator for function which takes no args,
and memoizes result.  exposes a ``.clear_cache`` method
to clear the cached value.
c                  V   <  SR ,          #   \          d     Mi ; iS! 4       ;p SR &   T # )T)KeyError)valuecacher   s    r   wrapper%memoize_single_value.<locals>.wrapper7   s9    	; 		"f$ds    c                  ,   < S P                  R R4       R# )TN)pop)r/   s   r   clear_cache)memoize_single_value.<locals>.clear_cache@   s    		$r   )r   r4   )r   r0   r4   r/   s   f  @r   memoize_single_valuer6   /   s2     E
4[  &Nr   c                   @   a  ] tR t^Ht o RtR tR tR tRR ltRt	V t
R# )	r   zE
decorator which invokes method once, then replaces attr with result
c                V    Wn         VP                  V n        VP                  V n        R # r
   )r   r   r   r   s   &&r   r   memoized_property.__init__M   s    ||r   c                `    Vf   V # V P                  V4      p\        WP                  V4       V# r
   )r   setattrr   )r   r   r   r.   s   &&& r   r   memoized_property.__get__R   s-    ;Kc"]]E*r   c                R    VP                   P                  V P                  R4       R# )zh
class-level helper to clear stored value (if any).

usage: :samp:`type(self).{attr}.clear_cache(self)`
N)__dict__r3   r   )r   r   s   &&r   r4   memoized_property.clear_cacheY   s     	-r   Nc                N    VP                   P                  V P                  V4      # )zh
class-level helper to peek at stored value

usage: :samp:`value = type(self).{attr}.clear_cache(self)`
)r>   getr   )r   r   defaults   &&&r   
peek_cachememoized_property.peek_cachea   s     ||w77r   )r   r   r   r
   )r   r   r   r   r   r   r   r4   rC   r    r!   r"   s   @r   r   r   H   s#     $
.8 8r   c                   a aaaaaa S fN   S'       d   Ro MRo S'       d
   S R,          o S'       d
   S R,          o S'       d   S RS R2,          o S R,          o VVVV VVV3R lpV# )	aJ  decorator to deprecate a function.

:arg msg: optional msg, default chosen if omitted
:kwd deprecated: version when function was first deprecated
:kwd removed: version when function will be removed
:kwd replacement: alternate name / instructions for replacing this function.
:kwd updoc: add notice to docstring (default ``True``)
z5the method %(mod)s.%(klass)s.%(name)s() is deprecatedz-the function %(mod)s.%(name)s() is deprecatedz as of Passlib %(deprecated)sz,, and will be removed in Passlib %(removed)sz, use  instead.c                 \  <a aaa S;'       d    \        S \        4      oS'       d   S P                  o \        S;'       g    S P                  S P
                  SS
R 7      oS'       d   V VV	V3R lpMS	S,          oV V3R lp\        VS 4       S'       Ed   S'       g	   S
'       d   VP                  '       d   RVP                  9  d   S;'       g    RpS
'       g	   S'       dM   VR,          pS
'       d   VRS
 2,          pS'       d   S
'       d
   VR,          pVRS R	2,          pVR
,          pVP                  P                  R4      P                  R4      '       g   V;P                  R,          un        V;P                  RV R2,          un        S'       d   \        V4      pV# ))modname
deprecatedremovedc                     < SP                  4       pS'       d
   V ^ ,          MV ^ ,          P                  pVP                  VP                  VP                  R7       \        SV,          \        ^R7       S! V / VB # )    )klassrI   
stacklevel)copy	__class__updater   r   r   DeprecationWarning)argskwdstmprO   r   is_classmethodmsgoptss   *,  r   r0   3deprecated_function.<locals>.build.<locals>.wrapper   s`    iik#1QtAw7H7H

U5E5E
FS3Y 2qAT*T**r   c                  8   < \        S\        ^R7       S! V / VB # )   rP   )r   rU   )rV   rW   r   texts   *,r   r0   r\      s     T-!<T*T**r   z.. deprecated:: z
    zand will be removed in version z, zuse rF   rG    
z
.. deprecated:: )

isinstanceclassmethodr   dictr   r   r   r   stripendswith)r   r0   txtrY   r[   r_   
_is_methodrK   func_modulerZ   rL   replacementupdocs   f  @@@r   build"deprecated_function.<locals>.build   sF   #EE
4(E==D..t!	
 + + :D+ 	w%Ew!8""C+x<WIFFCtT+h77Cs
??((-66t<<4'OO!3C5;;O!'*Gr    )rZ   rK   rL   rl   rk   ri   rj   rm   s   fffffff r   deprecated_functionrp   }   sd    " {ICAC22CAACVK=11Cs
/ /b Lr   c           	          \        WW#VRR7      # )aB  decorator to deprecate a method.

:arg msg: optional msg, default chosen if omitted
:kwd deprecated: version when method was first deprecated
:kwd removed: version when method will be removed
:kwd replacement: alternate name / instructions for replacing this method.
:kwd updoc: add notice to docstring (default ``True``)
T)ri   )rp   )rZ   rK   rL   rl   rk   s   &&&&&r   deprecated_methodrr      s      r   )r   r   r6   r   rp   rr   )NNNTNFN)NNNTN)r   r(   	functoolsr   r   warningsr   __all__r   r   r6   r   rp   rr   ro   r   r   <module>rv      sL     + " "0 0"28 8jOdr   