
    0;ji
                        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                            dd          ej                            dd          ej                            dd           eej                            dd                     eej                            dd                              Zeed<   dS )zFunction caching    N)AnyCallableTypeVar)Memory)FunctionMakerc           	      `    t          j        |dt           | |                    |          S )Nz"return decfunc(%(shortsignature)s))decfunc)__wrapped__)r   createdict)decfuncs     H/root/voice-cloning/.venv/lib/python3.11/site-packages/librosa/_cache.py_decorator_applyr      s;    ,SSYY	       _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dS )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                 b    |                     dd          }t          |i || _        || _        d S )Nlevel
   )popr   memoryr   )selfr   r   r   s       r   __init__zCacheManager.__init__    s8    

7B'' %d5f5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        %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   s6    {#/DJ%4G4G'(98DDD  r    )r   r   r%   s   `` r   __call__zCacheManager.__call__)   s)    	  	  	  	  	  	  r   Nc                 *     | j         j        |i | dS )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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22r   c                 *     | j         j        |i | dS )zReduce the size of the cacheN)r   reduce_sizer*   s      r   r0   zCacheManager.reduce_sizeJ   s"    000000r   c                 *     | j         j        |i | dS )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 1 1 13C 33 33 3 3 3 31 1 1 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_      				 ) ) ) ) ) ) ) ) ) )       # # # # # #   WT#s(+,,,9* 9* 9* 9* 9*6 9* 9* 9*z #lJNN&--jnn1488Z^^4e<<C
6::;;
#bjnn2B77
8
8  |     r   