
    &g                        d Z dZddlZddlZddlZ	 ddlmZ n# e$ r	 ddlmZ Y nw xY wddl	m
Z
mZmZmZmZmZ ddl	mZ ddl	mZ  G d	 d
e          Zd ZddZddZddZddZdej        dfdZddej        dfdZdS )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                   *    e Zd Zd Zed             ZdS )_UnboundTTLCachec                 H    t          j        | t          j        ||           d S N)r   __init__mathinf)selfttltimers      A/var/www/api/venv/lib/python3.11/site-packages/cachetools/func.pyr   z_UnboundTTLCache.__init__   s!    $#u55555    c                     d S r    )r   s    r   maxsizez_UnboundTTLCache.maxsize   s    tr   N)__name__
__module____qualname__r   propertyr!   r    r   r   r   r      s>        6 6 6   X  r   r   c                       fd}|S )Nc                     rt           j        nt           j        } t          |t	                      d          |           }fd|_        |S )NT)cachekeylockinfoc                       dS )Nr!   typedr    r-   s   r   <lambda>z+_cache.<locals>.decorator.<locals>.<lambda>    s    w+O+O r   )r   typedkeyhashkeyr   r	   cache_parameters)funcr)   wrapperr(   r!   r.   s      r   	decoratorz_cache.<locals>.decorator   sR    $6dmm$,G&u#EGG$GGGMM#O#O#O#O#O r   r    )r(   r!   r.   r5   s   ``` r   _cacher6      s0           r      Fc                     | t          i d|          S t          |           r' t          t          d          d|          |           S t          t          |           | |          S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a First In First Out (FIFO)
    algorithm.

    Nr7   )r6   callabler   r-   s     r   r   r   &   sg     b$&&&	'		 :1vinnc511':::i(('5999r   c                     | t          i d|          S t          |           r' t          t          d          d|          |           S t          t          |           | |          S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Frequently Used (LFU)
    algorithm.

    Nr7   )r6   r9   r   r-   s     r   r   r   4   g     b$&&&	'		 90vhsmmS%00999hw''%888r   c                     | t          i d|          S t          |           r' t          t          d          d|          |           S t          t          |           | |          S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Recently Used (LRU)
    algorithm.

    Nr7   )r6   r9   r   r-   s     r   r   r   B   r;   r   c                    ddl m}  |dt          d           | t          i d|          S t	          |           r' t          t          d          d|          |           S t          t          |           | |          S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Most Recently Used (MRU)
    algorithm.
    r   )warnz@mru_cache is deprecated   )
stacklevelNr7   )warningsr>   DeprecationWarningr6   r9   r   )r!   r.   r>   s      r   r   r   P   s    
 D	#%7AFFFFb$&&&	'		 90vhsmmS%00999hw''%888r   c                     | t          i d|          S t          |           r( t          t          d|          d|          |           S t          t          | |          | |          S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Random Replacement (RR)
    algorithm.

    Nr7   )r6   r9   r   )r!   choicer.   s      r   r   r   a   sn     b$&&&	'		 @7vgc6**C77@@@ggv..???r   iX  c                     | t          t          ||          d|          S t          |           r) t          t          d||          d|          |           S t          t          | ||          | |          S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Recently Used (LRU)
    algorithm with a per-item time-to-live (TTL) value.
    Nr7   )r6   r   r9   r   )r!   r   r   r.   s       r   r   r   o   s}    
 &sE22D%@@@	'		 E<vhsC//e<<WEEEhwU33WeDDDr   )r7   F)__doc____all__r   randomtime	threadingr	   ImportErrordummy_threading r   r   r   r   r   r   r   r   r   r6   r   r   r   r   rD   r   	monotonicr   r    r   r   <module>rO      s   E E
X   & & & &%%%%%%%%& I H H H H H H H H H H H H H H H                x     : : : :9 9 9 99 9 9 99 9 9 9" e @ @ @ @ s$. 
E 
E 
E 
E 
E 
Es    ''