o
    )i
                  
   @   s   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d Z
eded	ef d
ZG d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dZeed< dS )zFunction caching    N)AnyCallableTypeVar)Memory)FunctionMakerc                 C   s   t j|dt| |d|dS )Nz"return decfunc(%(shortsignature)s))Zdecfunc)__wrapped__)r   createdict)decfunc r   ]/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/librosa/_cache.py_decorator_apply   s   r   _F.)boundc                   @   s   e Zd ZdZdedefddZdedeegef fdd	Z	dededd
fddZ
dededefddZdededefddZdededd
fddZdededd
fd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                 O   s&   | dd}t|i || _|| _d S )Nlevel
   )popr   memoryr   )selfr   r   r   r   r   r   __init__    s   
zCacheManager.__init__r   returnc                    s    fdd}|S )z
        Cache with an explicitly defined level.

        Example usage:

        @cache(level=2)
        def semi_important_function(some_arguments):
            ...
        c                    s(   j jdurj krtj j| S | S )z4Add an input/output cache to the specified function.N)r   locationr   r   cache)functionr   r   r   r   wrapper4   s   z&CacheManager.__call__.<locals>.wrapperr   )r   r   r   r   r   r   __call__)   s   zCacheManager.__call__Nc                 O      | j j|i | dS )zClear the cacheN)r   clearr   r   r   r   r   r   r"   >      zCacheManager.clearc                 O      | j j|i |S )zEvaluate a function)r   evalr#   r   r   r   r&   B      zCacheManager.evalc                 O   r%   )z0Return the formatted representation of an object)r   formatr#   r   r   r   r(   F   r'   zCacheManager.formatc                 O   r!   )zReduce the size of the cacheN)r   reduce_sizer#   r   r   r   r)   J   r$   zCacheManager.reduce_sizec                 O   r!   )zRaise a warningN)r   warnr#   r   r   r   r*   N   r$   zCacheManager.warn)__name__
__module____qualname____doc__r   r   intr   r   r    r"   r&   r(   r)   r*   r   r   r   r   r      s    	r   ZLIBROSA_CACHE_DIRZLIBROSA_CACHE_MMAPZLIBROSA_CACHE_COMPRESSFZLIBROSA_CACHE_VERBOSEZLIBROSA_CACHE_LEVELr   )Z	mmap_modecompressverboser   r   )r.   ostypingr   r   r   Zjoblibr   	decoratorr   r   r   objectr   environgetr/   r   __annotations__r   r   r   r   <module>   s   	=