o
    ٷiL                     @   sV  d Z ddlmZmZmZmZmZmZ ddlZddl	Z	ddl
m
Z
 ddlZddlmZ ddlmZ g dZedZed	Zd
edededeeeef geeef f fddZdededeeeef geeef f fddZededef dZdddddddeeeee f  dee deeeeef   dedee deegef fddZdS )zHelpful tools for deprecation    )AnyCallableIterableOptionalTypeVarUnionN)	decorator)	DTypeLike)	ParamSpec)moved
deprecated	vectorizePR
moved_fromversionversion_removedreturnc                    s6   dt ttf dtjdtjdtf fdd}t|S )zgMark functions as moved/renamed.

    Using the decorated (old) function will result in a warning.
    funcargskwargsr   c                    s0   t jd | j| jtdd | |i |S ) Warn the user, and then proceed.zz{:s}
	This function was moved to '{:s}.{:s}' in librosa version {:s}.
	This alias will be removed in librosa version {:s}.   category
stacklevelwarningswarnformat
__module____name__FutureWarningr   r   r   r   r   r    K/home/ubuntu/.local/lib/python3.10/site-packages/librosa/util/decorators.py	__wrapper   s   
zmoved.<locals>.__wrapperr   r   r   r   r   r   )r   r   r   r'   r%   r$   r&   r      s   .r   c                    s4   dt ttf dtjdtjdtf fdd}t|S )zeMark a function as deprecated.

    Using the decorated (old) function will result in a warning.
    r   r   r   r   c                    s.   t jd| j| j tdd | |i |S )r   z^{:s}.{:s}
	Deprecated as of librosa version {:s}.
	It will be removed in librosa version {:s}.r   r   r   r#   r   r   r%   r&   r'   5   s   zdeprecated.<locals>.__wrapperr(   )r   r   r'   r%   r)   r&   r   -   s   ,r   _F.)boundFotypesdocexcludedcache	signaturer-   r.   r/   r0   r1   c                    s    fdd}|S )zWrap a function for use with np.vectorize.

    This function is not quite a decorator, but is used as a wrapper
    to np.vectorize that preserves scalar behavior.
    c                    s0   t j| d t|  fdd}|S )Nr,   c                     s(    | i |}t | d r| S |S )Nr   )npisscalaritem)r   r   yvecfuncr%   r&   _vec_   s   z*vectorize.<locals>.__wrapper.<locals>._vec)r2   r   	functoolswraps)functionr8   r0   r.   r/   r-   r1   r6   r&   r'   U   s   	zvectorize.<locals>.__wrapperr%   )r-   r.   r/   r0   r1   r'   r%   r<   r&   r   G   s   r   )__doc__typingr   r   r   r   r   r   r   r9   r   numpyr2   numpy.typingr	   typing_extensionsr
   __all__r   r   strr   r   r*   intboolr   r%   r%   r%   r&   <module>   s\    

