Viewing File: /opt/alt/python35/lib/python3.5/site-packages/__pycache__/cached_property.cpython-35.opt-1.pyc



\UV<@sdZdZdZdZddlmZddlZGdddeZGd	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|_||_dS)N__doc__)getattrrfunc)selfrr/cached_property.py__init__szcached_property.__init__cCs4|dkr|S|j|}|j|jj<|S)N)r__dict____name__)robjclsvaluerrr	__get__s zcached_property.__get__N)r
__module____qualname__rr
rrrrr	rsrc@s.eZdZdZddZddZdS)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	threadingRLocklock)rrrrr	r
$s	z!threaded_cached_property.__init__cCst|dkr|S|j}|jj}|j?y||SWn+tk
rh|j||j|SYnXWdQRXdS)N)rrrrKeyError
setdefault)rr
robj_dictnamerrr	r)s	

z threaded_cached_property.__get__N)rrrrr
rrrrr	rsrc@saeZdZdZdddZddZddZd	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}||_|j|dS)N)callablettl
_prepare_func)rrrrrr	r
?s		z!cached_property_with_ttl.__init__cCs|j||S)N)r)rrrrr	__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)rrrrrr)	rr
rZnowrrrZlast_updatedZttl_expiredrrr	rLs			
z cached_property_with_ttl.__get__cCs|jj|jddS)N)rpopr)rr
rrr	
__delete__`sz#cached_property_with_ttl.__delete__cCs|tf|j|j<dS)N)rrr)rr
rrrr	__set__csz cached_property_with_ttl.__set__cCs7||_|r3|j|_|j|_|j|_dS)N)rrrr)rrrrr	rfs
	z&cached_property_with_ttl._prepare_func)
rrrrr
rrr!r"rrrrr	r8s	rcs=eZdZdZdfddZfddZS)!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#r
rrr)rr)	__class__rr	r
xsz*threaded_cached_property_with_ttl.__init__c
s.|jtt|j||SWdQRXdS)N)rr$r#r)rr
r)r%rr	r|s
z)threaded_cached_property_with_ttl.__get__)rrrrr
rrr)r%r	r#rsr#)
__author__Z	__email____version__Z__license__rrobjectrrrZcached_property_ttlZtimed_cached_propertyr#Zthreaded_cached_property_ttlZtimed_threaded_cached_propertyrrrr	<module>s6
Back to Directory File Manager