
    }Kg
                        U d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 d Z
 ededef   	      Z G d
 de      Z eej                  j                  dd      ej                  j                  dd      ej                  j                  dd       eej                  j                  dd             eej                  j                  dd                  Zeed<   y)zFunction caching    N)AnyCallableTypeVar)Memory)FunctionMakerc           	      T    t        j                  |dt         | |            |      S )Nz"return decfunc(%(shortsignature)s))decfunc)__wrapped__)r   createdict)decfuncs     R/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/librosa/_cache.py_decorator_applyr      s*    ,SY	     _F.)boundc                       e Zd ZdZdedefdZdedeegef   fdZ	dededdfd	Z
dededefd
ZdededefdZdededdfdZdededdfdZy)CacheManagera)  The librosa cache manager class wraps joblib.Memory
    with a __call__ attribute, so that it may act as a function.

    Additionally, it provides a caching level filter, so that
    different functions can be cached or not depending on the user's
    preference for speed vs. storage usage.
    argskwargsc                 V    |j                  dd      }t        |i || _        || _        y )Nlevel
   )popr   memoryr   )selfr   r   r   s       r   __init__zCacheManager.__init__    s.    

7B' %d5f5  
r   r   returnc                       fd}|S )z
        Cache with an explicitly defined level.

        Example usage:

        @cache(level=2)
        def semi_important_function(some_arguments):
            ...
        c                     j                   j                  /j                  k\  r t        j                   j                  |       S | S )z4Add an input/output cache to the specified function.)r   locationr   r   cache)functionr   r   s    r   wrapperz&CacheManager.__call__.<locals>.wrapper4   s<    {{##/DJJ%4G'(9(98DD  r    )r   r   r%   s   `` r   __call__zCacheManager.__call__)   s    	  r   Nc                 <     | j                   j                  |i | y)zClear the cacheN)r   clearr   r   r   s      r   r)   zCacheManager.clear>   s    4*6*r   c                 :     | j                   j                  |i |S )zEvaluate a function)r   evalr*   s      r   r,   zCacheManager.evalB   s    t{{000r   c                 :     | j                   j                  |i |S )z0Return the formatted representation of an object)r   formatr*   s      r   r.   zCacheManager.formatF   s    !t{{!!42622r   c                 <     | j                   j                  |i | y)zReduce the size of the cacheN)r   reduce_sizer*   s      r   r0   zCacheManager.reduce_sizeJ   s    00r   c                 <     | j                   j                  |i | y)zRaise a warningN)r   warnr*   s      r   r2   zCacheManager.warnN   s    $)&)r   )__name__
__module____qualname____doc__r   r   intr   r   r'   r)   r,   r.   r0   r2   r&   r   r   r   r      s     c  S  c htRx&8 *+3 +# +$ +1# 1 1 13C 33 33 31 1 1 1*# * * *r   r   LIBROSA_CACHE_DIRLIBROSA_CACHE_MMAPLIBROSA_CACHE_COMPRESSFLIBROSA_CACHE_VERBOSELIBROSA_CACHE_LEVELr   )	mmap_modecompressverboser   r#   )r6   ostypingr   r   r   joblibr   	decoratorr   r   r   objectr   environgetr7   r#   __annotations__r&   r   r   <module>rH      s     	 ) )  # T#s(+,9*6 9*z #JJNN&-jjnn148ZZ^^4e<

6:;
bjjnn2B7
8| r   