# Path: librosa/_cache.py
# def _decorator_apply(dec, func):
#     def __init__(self, *args, **kwargs):
#     def __call__(self, level):
#         def wrapper(function):
#     def clear(self, *args, **kwargs):
#     def eval(self, *args, **kwargs):
#     def format(self, *args, **kwargs):
#     def reduce_size(self, *args, **kwargs):
#     def warn(self, *args, **kwargs):
# class CacheManager(object):
# 
# Path: librosa/util/exceptions.py
# class ParameterError(LibrosaError):
#     """Exception class for mal-formed inputs"""
# 
#     pass
# 
# Path: librosa/util/deprecation.py
# class Deprecated(object):
#     """A dummy class to catch usage of deprecated variable names"""
# 
#     def __repr__(self):
#         return "<DEPRECATED parameter>"
# 
# Path: librosa/util/decorators.py
# def deprecate_positional_args(func=None, *, version="0.10"):
#     """Decorator for methods that issues warnings for positional arguments.
#     Using the keyword-only argument syntax in pep 3102, arguments after the
#     * will issue a warning when passed as a positional argument.
#     Parameters
#     ----------
#     func : callable, default=None
#         Function to check arguments on.
#     version : callable, default="0.10"
#         The version when positional arguments will result in error.
#     """
# 
#     def _inner_deprecate_positional_args(f):
#         sig = signature(f)
#         kwonly_args = []
#         all_args = []
# 
#         for name, param in sig.parameters.items():
#             if param.kind == Parameter.POSITIONAL_OR_KEYWORD:
#                 all_args.append(name)
#             elif param.kind == Parameter.KEYWORD_ONLY:
#                 kwonly_args.append(name)
# 
#         @wraps(f)
#         def inner_f(*args, **kwargs):
#             extra_args = len(args) - len(all_args)
#             if extra_args <= 0:
#                 return f(*args, **kwargs)
# 
#             # extra_args > 0
#             args_msg = [
#                 "{}={}".format(name, arg)
#                 for name, arg in zip(kwonly_args[:extra_args], args[-extra_args:])
#             ]
#             args_msg = ", ".join(args_msg)
#             warnings.warn(
#                 f"Pass {args_msg} as keyword args. From version "
#                 f"{version} passing these as positional arguments "
#                 "will result in an error",
#                 FutureWarning,
#                 stacklevel=2,
#             )
#             kwargs.update(zip(sig.parameters, args))
#             return f(**kwargs)
# 
#         return inner_f
# 
#     if func is not None:
#         return _inner_deprecate_positional_args(func)
# 
#     return _inner_deprecate_positional_args


import scipy.ndimage
import scipy.sparse
import numpy as np
import numba
from numpy.lib.stride_tricks import as_strided
from .._cache import cache
from .exceptions import ParameterError
from .deprecation import Deprecated
from .decorators import deprecate_positional_args
    ParameterError
        If any input lies outside its defined range

    Examples
    --------
    >>> y, sr = librosa.load(librosa.ex('trumpet'))
    >>> onset_env = librosa.onset.onset_strength(y=y, sr=sr,
    ...                                          hop_length=512,
    ...                                          aggregate=np.median)
    >>> peaks = librosa.util.peak_pick(onset_env, pre_max=3, post_max=3, pre_avg=3, post_avg=5, delta=0.5, wait=10)
    >>> peaks
    array([  3,  27,  40,  61,  72,  88, 103])

    >>> import matplotlib.pyplot as plt
    >>> times = librosa.times_like(onset_env, sr=sr, hop_length=512)
    >>> fig, ax = plt.subplots(nrows=2, sharex=True)
    >>> D = np.abs(librosa.stft(y))
    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),
    ...                          y_axis='log', x_axis='time', ax=ax[1])
    >>> ax[0].plot(times, onset_env, alpha=0.8, label='Onset strength')
    >>> ax[0].vlines(times[peaks], 0,
    ...              onset_env.max(), color='r', alpha=0.8,
    ...              label='Selected peaks')
    >>> ax[0].legend(frameon=True, framealpha=0.8)
    >>> ax[0].label_outer()
    """

    if pre_max < 0:
        raise ParameterError("pre_max must be non-negative")
    if pre_avg < 0:

# Path: librosa/_cache.py
# def _decorator_apply(dec, func):
#     def __init__(self, *args, **kwargs):
#     def __call__(self, level):
#         def wrapper(function):
#     def clear(self, *args, **kwargs):
#     def eval(self, *args, **kwargs):
#     def format(self, *args, **kwargs):
#     def reduce_size(self, *args, **kwargs):
#     def warn(self, *args, **kwargs):
# class CacheManager(object):
# 
# Path: librosa/util/exceptions.py
# class ParameterError(LibrosaError):
#     """Exception class for mal-formed inputs"""
# 
#     pass
# 
# Path: librosa/util/deprecation.py
# class Deprecated(object):
#     """A dummy class to catch usage of deprecated variable names"""
# 
#     def __repr__(self):
#         return "<DEPRECATED parameter>"
# 
# Path: librosa/util/decorators.py
# def deprecate_positional_args(func=None, *, version="0.10"):
#     """Decorator for methods that issues warnings for positional arguments.
#     Using the keyword-only argument syntax in pep 3102, arguments after the
#     * will issue a warning when passed as a positional argument.
#     Parameters
#     ----------
#     func : callable, default=None
#         Function to check arguments on.
#     version : callable, default="0.10"
#         The version when positional arguments will result in error.
#     """
# 
#     def _inner_deprecate_positional_args(f):
#         sig = signature(f)
#         kwonly_args = []
#         all_args = []
# 
#         for name, param in sig.parameters.items():
#             if param.kind == Parameter.POSITIONAL_OR_KEYWORD:
#                 all_args.append(name)
#             elif param.kind == Parameter.KEYWORD_ONLY:
#                 kwonly_args.append(name)
# 
#         @wraps(f)
#         def inner_f(*args, **kwargs):
#             extra_args = len(args) - len(all_args)
#             if extra_args <= 0:
#                 return f(*args, **kwargs)
# 
#             # extra_args > 0
#             args_msg = [
#                 "{}={}".format(name, arg)
#                 for name, arg in zip(kwonly_args[:extra_args], args[-extra_args:])
#             ]
#             args_msg = ", ".join(args_msg)
#             warnings.warn(
#                 f"Pass {args_msg} as keyword args. From version "
#                 f"{version} passing these as positional arguments "
#                 "will result in an error",
#                 FutureWarning,
#                 stacklevel=2,
#             )
#             kwargs.update(zip(sig.parameters, args))
#             return f(**kwargs)
# 
#         return inner_f
# 
#     if func is not None:
#         return _inner_deprecate_positional_args(func)
# 
#     return _inner_deprecate_positional_args


# Path: librosa/util/utils.py
import scipy.ndimage
import scipy.sparse
import numpy as np
import numba
from numpy.lib.stride_tricks import as_strided
from .._cache import cache
from .exceptions import ParameterError
from .deprecation import Deprecated
from .decorators import deprecate_positional_args

    ParameterError
        If any input lies outside its defined range

    Examples
    --------
    >>> y, sr = librosa.load(librosa.ex('trumpet'))
    >>> onset_env = librosa.onset.onset_strength(y=y, sr=sr,
    ...                                          hop_length=512,
    ...                                          aggregate=np.median)
    >>> peaks = librosa.util.peak_pick(onset_env, pre_max=3, post_max=3, pre_avg=3, post_avg=5, delta=0.5, wait=10)
    >>> peaks
    array([  3,  27,  40,  61,  72,  88, 103])

    >>> import matplotlib.pyplot as plt
    >>> times = librosa.times_like(onset_env, sr=sr, hop_length=512)
    >>> fig, ax = plt.subplots(nrows=2, sharex=True)
    >>> D = np.abs(librosa.stft(y))
    >>> librosa.display.specshow(librosa.amplitude_to_db(D, ref=np.max),
    ...                          y_axis='log', x_axis='time', ax=ax[1])
    >>> ax[0].plot(times, onset_env, alpha=0.8, label='Onset strength')
    >>> ax[0].vlines(times[peaks], 0,
    ...              onset_env.max(), color='r', alpha=0.8,
    ...              label='Selected peaks')
    >>> ax[0].legend(frameon=True, framealpha=0.8)
    >>> ax[0].label_outer()
    """

    if pre_max < 0:
        raise ParameterError("pre_max must be non-negative")
    if pre_avg < 0:

        raise ParameterError("pre_avg must be non-negative")