File: //opt/alt/python37/lib/python3.7/site-packages/cachetools/__pycache__/func.cpython-37.pyc
B
��f� � @ s� d Z dZddlZddlZddlZyddlmZ W n ek
rP ddlmZ Y nX ddl m
Z
mZmZm
Z
mZmZ ddl mZ ddl mZ G d d
� d
e�Zdd� Zddd�Zddd�Zddd�Zddd�Zd
ejdfdd�Zd
dejdfdd�ZdS ) z?`functools.lru_cache` compatible memoizing function decorators.)�
fifo_cache� lfu_cache� lru_cache� mru_cache�rr_cache� ttl_cache� N)�RLock� )� FIFOCache�LFUCache�LRUCache�MRUCache�RRCache�TTLCache)�cached)�keysc @ s e Zd Zdd� Zedd� �ZdS )�_UnboundTTLCachec C s t �| tj||� d S )N)r �__init__�math�inf)�self�ttl�timer� r �@/opt/alt/python37/lib/python3.7/site-packages/cachetools/func.pyr s z_UnboundTTLCache.__init__c C s d S )Nr )r r r r �maxsize s z_UnboundTTLCache.maxsizeN)�__name__�
__module__�__qualname__r �propertyr r r r r r s r c s � ��fdd�}|S )Nc s: �r
t jnt j}t� |t� dd�| �}��fdd�|_|S )NT)�cache�key�lock�infoc s
� �d�S )N)r �typedr r )r r$ r r �<lambda> � z+_cache.<locals>.decorator.<locals>.<lambda>)r ZtypedkeyZhashkeyr r Zcache_parameters)�funcr! �wrapper)r r r$ r r � decorator s z_cache.<locals>.decoratorr )r r r$ r) r )r r r$ r �_cache s r* � Fc C sD | dkrt i d|�S t| �r0t td�d|�| �S t t| �| |�S dS )z�Decorator to wrap a function with a memoizing callable that saves
up to `maxsize` results based on a First In First Out (FIFO)
algorithm.
Nr+ )r* �callabler
)r r$ r r r r &