o
    oi                  
   @   s   d Z ddlZddlmZ ddlmZ d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dS )zFunction caching    N)Memory)FunctionMakerc                 C   s   t j|dt| |d|dS )Nz"return decfunc(%(shortsignature)s))decfunc)__wrapped__)r   createdict)decfunc r
   L/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/librosa/_cache.py_decorator_apply
   s   r   c                   @   sH   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	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.
    c                 O   s&   | dd}t|i || _|| _d S )Nlevel
   )popr   memoryr   )selfargskwargsr   r
   r
   r   __init__   s   
zCacheManager.__init__c                    s    fdd}|S )zuExample 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 )zVDecorator function.  Adds an input/output cache to
            the specified function.N)r   locationr   r   cache)functionr   r   r
   r   wrapper.   s   z&CacheManager.__call__.<locals>.wrapperr
   )r   r   r   r
   r   r   __call__&   s   	zCacheManager.__call__c                 O      | j j|i |S N)r   clearr   r   r   r
   r
   r   r   9      zCacheManager.clearc                 O   r   r   )r   evalr   r
   r
   r   r!   <   r    zCacheManager.evalc                 O   r   r   )r   formatr   r
   r
   r   r"   ?   r    zCacheManager.formatc                 O   r   r   )r   reduce_sizer   r
   r
   r   r#   B   r    zCacheManager.reduce_sizec                 O   r   r   )r   warnr   r
   r
   r   r$   E   r    zCacheManager.warnN)__name__
__module____qualname____doc__r   r   r   r!   r"   r#   r$   r
   r
   r
   r   r      s    
r   LIBROSA_CACHE_DIRLIBROSA_CACHE_MMAPLIBROSA_CACHE_COMPRESSFLIBROSA_CACHE_VERBOSELIBROSA_CACHE_LEVELr   )	mmap_modecompressverboser   )r(   osjoblibr   	decoratorr   r   objectr   environgetintr   r
   r
   r
   r   <module>   s   	7
