%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/passlib/utils/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/passlib/utils/__pycache__/decor.cpython-39.pyc

a

f�Wc��@s�dZddlmZmZmZddlZe�e�Zddl	m
Z
mZddlZddl
mZddlmZgd�ZGdd	�d	e�ZGd
d�de�Zdd
�ZGdd�de�Zddd�Zddd�ZdS)z7
passlib.utils.decor -- helper decorators & properties
�)�absolute_import�division�print_functionN)�wraps�update_wrapper)�warn)�PY3)�
classproperty�
hybrid_method�memoize_single_value�memoized_property�deprecated_function�deprecated_methodc@s,eZdZdZdd�Zdd�Zedd��ZdS)	r	zjFunction decorator which acts like a combination of classmethod+property (limited to read-only properties)cCs
||_dS�N��im_func��self�func�r�7/usr/lib/python3.9/site-packages/passlib/utils/decor.py�__init__#szclassproperty.__init__cCs
|�|�Srr�r�obj�clsrrr�__get__&szclassproperty.__get__cCs|jS)zpy3 compatible aliasr�rrrr�__func__)szclassproperty.__func__N)�__name__�
__module__�__qualname__�__doc__rr�propertyrrrrrr	 s
r	c@s eZdZdZdd�Zdd�ZdS)r
z�
    decorator which invokes function with class if called as class method,
    and with object if called at instance level.
    cCs||_t||�dSr)rrrrrrr4szhybrid_method.__init__cCs2|dur|}trt�|j|�St�|j||�SdSr)r�types�
MethodTyperrrrrr8s
zhybrid_method.__get__N)rrr r!rrrrrrr
.sr
cs0i�t����fdd��}�fdd�}||_|S)z�
    decorator for function which takes no args,
    and memoizes result.  exposes a ``.clear_cache`` method
    to clear the cached value.
    cs0z
�dWStyYn0��}�d<|S�NT)�KeyError)�value��cacherrr�wrapperLs
z%memoize_single_value.<locals>.wrappercs��dd�dSr%)�popr)r)rr�clear_cacheUsz)memoize_single_value.<locals>.clear_cache)rr,)rr*r,rr(rrDsrc@sBeZdZdZdd�Zdd�Zes,edd��Zdd	�Z	d
dd�Z
d
S)rzM
    decorator which invokes method once, then replaces attr with result
    cCs||_|j|_|j|_dSr)rrr!rrrrr_szmemoized_property.__init__cCs(|dur|S|�|�}t||j|�|Sr)r�setattrr)rrrr'rrrrds

zmemoized_property.__get__cCs|jS)z	py2 alias)rrrrrrmszmemoized_property.im_funccCs|j�|jd�dS)z�
        class-level helper to clear stored value (if any).

        usage: :samp:`type(self).{attr}.clear_cache(self)`
        N)�__dict__r+r)rrrrrr,rszmemoized_property.clear_cacheNcCs|j�|j|�S)z�
        class-level helper to peek at stored value

        usage: :samp:`value = type(self).{attr}.clear_cache(self)`
        )r.�getr)rr�defaultrrr�
peek_cachezszmemoized_property.peek_cache)N)rrr r!rrrr"rr,r1rrrrr[s
rTFcsb�durF�rd�nd��r"�d7��r.�d7��r>�d�7��d7��������fdd	�}|S)
abdecorator 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``)
    Nz5the 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 %s instead�.cs*�ot�t���r ��dt�j�t�p*�j�j��d���rP����fdd�}n�����fdd�}t|���
�r�s���r|j	�rd|j	v�r�p�d}�s��	r�|d7}�r�|d�f7}�	rڈr�|d	7}|d
�	7}|d7}|j	�
d��d
��s|j	d
7_	|j	d|f7_	��r&t|�}|S)N)�mod�name�
deprecated�removedcsP���}�r|dn|dj}|j|j|jd�t�|tdd��|i|��S)Nr)�klassr3���
stacklevel)�copy�	__class__�updaterrr�DeprecationWarning)�args�kwds�tmpr7)r�is_classmethod�msg�optsrrr*�s
z3deprecated_function.<locals>.build.<locals>.wrappercst�tdd��|i|��S)Nr8r9)rr>)r?r@)r�textrrr*�sz.. deprecated::�z
    z!and will be removed in version %sz, zuse %s insteadr2� �
z
.. deprecated:: %s
)�
isinstance�classmethodr�typer�dictrrrr!�strip�endswith)rr*Ztxt��
_is_methodr5�func_modulerCr6�replacement�updoc)rrBrDrEr�build�sF�
��z"deprecated_function.<locals>.buildr)rCr5r6rSrRrPrQrTrrOrr
�s*r
cCst|||||dd�S)aZdecorator 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)rP)r
)rCr5r6rSrRrrrr�s
�r)NNNTNFN)NNNTN)r!Z
__future__rrrZloggingZ	getLoggerr�log�	functoolsrrr#�warningsrZpasslib.utils.compatr�__all__�objectr	r
rrr
rrrrr�<module>s&
<�
C�

Zerion Mini Shell 1.0