Ë
    ðmxi-  ã                   óæ   — d Z dZddlZddlZddlZddlZddlmZ ddl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ej*                  dfd„Zddej.                  dfd„Zy)z?`functools.lru_cache` compatible memoizing function decorators.)Ú
fifo_cacheÚ	lfu_cacheÚ	lru_cacheÚrr_cacheÚ	ttl_cacheé    N)Ú	Conditioné   )Ú	FIFOCacheÚLFUCacheÚLRUCacheÚRRCacheÚTTLCache)Úcached)Úkeysc                   ó"   — e Zd Zd„ Zed„ «       Zy)Ú_UnboundTTLCachec                 óP   — t        j                  | t        j                  ||«       y ©N)r   Ú__init__ÚmathÚinf)ÚselfÚttlÚtimers      úF/home/htdocs/ttos/venv/lib/python3.12/site-packages/cachetools/func.pyr   z_UnboundTTLCache.__init__   s   € Ü×Ñ˜$¤§¡¨#¨uÕ5ó    c                  ó   — y r   © )r   s    r   Úmaxsizez_UnboundTTLCache.maxsize   s   € àr   N)Ú__name__Ú
__module__Ú__qualname__r   Úpropertyr   r   r   r   r   r      s   „ ò6ð ñó ñr   r   c                 ó   ‡ ‡‡— ˆ ˆˆfd„}|S )Nc                 óœ   •— ‰rt         j                  nt         j                  } t        ‰|t	        «       d¬«      | «      }ˆˆfd„|_        |S )NT)ÚcacheÚkeyÚ	conditionÚinfoc                  ó   •— ‰ ‰dœS )N©r   Útypedr   r+   s   €€r   ú<lambda>z+_cache.<locals>.decorator.<locals>.<lambda>   s   ø€ °wÈÑ+O€ r   )r   ÚtypedkeyÚhashkeyr   r   Úcache_parameters)Úfuncr'   Úwrapperr&   r   r,   s      €€€r   Ú	decoratorz_cache.<locals>.decorator   s;   ø€ Ù$Œd�mŠm¬$¯,©,ˆØP”&˜u¨#¼»È4ÔPÐQUÓVˆÜ#OˆÔ Øˆr   r   )r&   r   r,   r3   s   ``` r   Ú_cacher4      s   ú€ öð Ðr   é€   Fc                 óš   — | €t        i d|«      S t        | «      r t        t        d«      d|«      | «      S t        t        | «      | |«      S )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.

    Nr5   )r4   Úcallabler
   r+   s     r   r   r   #   sN   € ð €Ü�b˜$ Ó&Ð&Ü	�'Ô	Ø1Œv”i “n c¨5Ó1°'Ó:Ð:ä”i Ó(¨'°5Ó9Ð9r   c                 óš   — | €t        i d|«      S t        | «      r t        t        d«      d|«      | «      S t        t        | «      | |«      S )z™Decorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Frequently Used (LFU)
    algorithm.

    Nr5   )r4   r7   r   r+   s     r   r   r   1   óN   € ð €Ü�b˜$ Ó&Ð&Ü	�'Ô	Ø0Œv”h˜s“m S¨%Ó0°Ó9Ð9ä”h˜wÓ'¨°%Ó8Ð8r   c                 óš   — | €t        i d|«      S t        | «      r t        t        d«      d|«      | «      S t        t        | «      | |«      S )z—Decorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Recently Used (LRU)
    algorithm.

    Nr5   )r4   r7   r   r+   s     r   r   r   ?   r9   r   c                 óž   — | €t        i d|«      S t        | «      r t        t        d|«      d|«      | «      S t        t        | |«      | |«      S )z•Decorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Random Replacement (RR)
    algorithm.

    Nr5   )r4   r7   r   )r   Úchoicer,   s      r   r   r   M   sS   € ð €Ü�b˜$ Ó&Ð&Ü	�'Ô	Ø7Œv”g˜c 6Ó*¨C°Ó7¸Ó@Ð@ä”g˜g vÓ.°¸Ó?Ð?r   iX  c                 ó¶   — | €t        t        ||«      d|«      S t        | «      r t        t        d||«      d|«      | «      S t        t        | ||«      | |«      S )zÀDecorator 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.

    Nr5   )r4   r   r7   r   )r   r   r   r,   s       r   r   r   [   s_   € ð €ÜÔ& s¨EÓ2°D¸%Ó@Ð@Ü	�'Ô	Ø<Œv”h˜s C¨Ó/°°eÓ<¸WÓEÐEä”h˜w¨¨UÓ3°W¸eÓDÐDr   )r5   F)Ú__doc__Ú__all__Ú	functoolsr   ÚrandomÚtimeÚ	threadingr   Ú r
   r   r   r   r   r   r   r   r4   r   r   r   r<   r   Ú	monotonicr   r   r   r   ú<module>rF      sp   ðÙ Eà
K€ã Û Û Û Ý ç >Õ >Ý Ý ô�xô òó:ó9ó9ð  §¡°eó @ð ˜s¨$¯.©.Àô Er   