Viewing File: /opt/alt/python38/lib/python3.8/site-packages/__pycache__/cached_property.cpython-38.pyc

U

\UV<@sxdZdZdZdZddlmZddlZGdddeZGd	d
d
eZGdddeZ	e	Z
e	ZGd
dde	ZeZ
eZdS)zDaniel Greenfeldzpydanny@gmail.comz1.3.0ZBSD)timeNc@s eZdZdZddZddZdS)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|_||_dSN__doc__)getattrrfuncselfrr
/cached_property.py__init__szcached_property.__init__cCs(|dkr|S||}|j|jj<|SN)r__dict____name__)r	objclsvaluer
r
r__get__szcached_property.__get__Nr
__module____qualname__rrrr
r
r
rrsrc@s eZdZdZddZddZdS)threaded_cached_property
    A cached_property version for use in environments where multiple threads
    might concurrently try to access the property.
    cCs t|d|_||_t|_dSr)rrr	threadingRLocklockrr
r
rr$sz!threaded_cached_property.__init__c
Csz|dkr|S|j}|jj}|jPz||WW5QRStk
rj||||YW5QRSXW5QRXdSr
)rrrrKeyError
setdefault)r	rrobj_dictnamer
r
rr)sz threaded_cached_property.__get__Nrr
r
r
rrsrc@sBeZdZdZdddZddZddZd	d
ZddZd
dZ	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}||_||dSr
)callablettl
_prepare_func)r	r"rr
r
rr?sz!cached_property_with_ttl.__init__cCs|||Sr
)r#rr
r
r__call__Hs
z!cached_property_with_ttl.__call__c	Csz|dkr|St}|j}|j}z||\}}Wntk
rBYnX|joV|j||k}|s`|S||}||f||<|Sr
)rrrrr"r)	r	rrZnowrrrZlast_updatedZttl_expiredr
r
rrLs
z cached_property_with_ttl.__get__cCs|j|jddSr
)rpopr)r	rr
r
r
__delete__`sz#cached_property_with_ttl.__delete__cCs|tf|j|j<dSr
)rrr)r	rrr
r
r__set__csz cached_property_with_ttl.__set__cCs&||_|r"|j|_|j|_|j|_dSr
)rrrrrr
r
rr#fs
z&cached_property_with_ttl._prepare_func)N)
rrrrrr$rr&r'r#r
r
r
rr 8s
	r cs.eZdZdZdfdd	ZfddZZS)!threaded_cached_property_with_ttlrNcstt||t|_dSr
)superr(rrrr)r	r"	__class__r
rrxsz*threaded_cached_property_with_ttl.__init__c
s0|j tt|||W5QRSQRXdSr
)rr)r(r)r	rrr*r
rr|sz)threaded_cached_property_with_ttl.__get__)N)rrrrrr
__classcell__r
r
r*rr(rsr()
__author__Z	__email____version__Z__license__rrobjectrrr Zcached_property_ttlZtimed_cached_propertyr(Zthreaded_cached_property_ttlZtimed_threaded_cached_propertyr
r
r
r<module>s6
Back to Directory File Manager