Your IP : 216.73.216.196


Current Path : /opt/alt/python35/lib/python3.5/site-packages/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/__pycache__/cached_property.cpython-35.pyc



\UV<�@s�dZdZdZdZddlmZddlZGdd�de�ZGd	d
�d
e�ZGdd�de�Z	e	Z
e	ZGd
d�de	�ZeZ
eZdS)zDaniel Greenfeldzpydanny@gmail.comz1.3.0�BSD�)�timeNc@s.eZdZdZdd�Zdd�ZdS)�cached_propertya
    A property that is only computed once per instance and then replaces itself
    with an ordinary attribute. Deleting the attribute resets the property.
    Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
    cCst|d�|_||_dS)N�__doc__)�getattrr�func)�selfr�r	�@/opt/alt/python35/lib/python3.5/site-packages/cached_property.py�__init__szcached_property.__init__cCs4|dkr|S|j|�}|j|jj<|S)N)r�__dict__�__name__)r�obj�cls�valuer	r	r
�__get__s zcached_property.__get__N)r
�
__module__�__qualname__rrrr	r	r	r
rsrc@s.eZdZdZdd�Zdd�ZdS)�threaded_cached_propertyz�
    A cached_property version for use in environments where multiple threads
    might concurrently try to access the property.
    cCs.t|d�|_||_tj�|_dS)Nr)rrr�	threading�RLock�lock)rrr	r	r
r$s	z!threaded_cached_property.__init__cCst|dkr|S|j}|jj}|j�?y||SWn+tk
rh|j||j|��SYnXWdQRXdS)N)rrr
r�KeyError�
setdefault)rrr�obj_dict�namer	r	r
r)s	

z threaded_cached_property.__get__N)r
rrrrrr	r	r	r
rsrc@saeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�cached_property_with_ttlz�
    A property that is only computed once per instance and then replaces itself
    with an ordinary attribute. Setting the ttl to a number expresses how long
    the property will last before being timed out.
    NcCs;t|�r|}d}nd}||_|j|�dS)N)�callable�ttl�
_prepare_func)rrrr	r	r
r?s		z!cached_property_with_ttl.__init__cCs|j|�|S)N)r)rrr	r	r
�__call__Hs
z!cached_property_with_ttl.__call__c	Cs�|dkr|St�}|j}|j}y||\}}Wntk
rSYn'X|jom|j||k}|sz|S|j|�}||f||<|S)N)rrr
rrr)	rrr�nowrrrZlast_updatedZttl_expiredr	r	r
rLs			
z cached_property_with_ttl.__get__cCs|jj|jd�dS)N)r�popr
)rrr	r	r
�
__delete__`sz#cached_property_with_ttl.__delete__cCs|t�f|j|j<dS)N)rrr
)rrrr	r	r
�__set__csz cached_property_with_ttl.__set__cCs7||_|r3|j|_|j|_|j|_dS)N)rrr
r)rrr	r	r
rfs
	z&cached_property_with_ttl._prepare_func)
r
rrrrr rr#r$rr	r	r	r
r8s	rcs=eZdZdZd�fdd�Z�fdd�Z�S)�!threaded_cached_property_with_ttlz�
    A cached_property version for use in environments where multiple threads
    might concurrently try to access the property.
    Ncs)tt|�j|�tj�|_dS)N)�superr%rrrr)rr)�	__class__r	r
rxsz*threaded_cached_property_with_ttl.__init__c
s.|j�tt|�j||�SWdQRXdS)N)rr&r%r)rrr)r'r	r
r|s
z)threaded_cached_property_with_ttl.__get__)r
rrrrrr	r	)r'r
r%rsr%)�
__author__�	__email__�__version__�__license__rr�objectrrrZcached_property_ttlZtimed_cached_propertyr%Zthreaded_cached_property_ttlZtimed_threaded_cached_propertyr	r	r	r
�<module>s6