# Path: librosa/util/exceptions.py
# class ParameterError(LibrosaError):
#     """Exception class for mal-formed inputs"""
# 
#     pass
# 
# Path: librosa/util/utils.py
# def valid_intervals(intervals):
#     """Ensure that an array is a valid representation of time intervals:
# 
#         - intervals.ndim == 2
#         - intervals.shape[1] == 2
#         - intervals[i, 0] <= intervals[i, 1] for all i
# 
#     Parameters
#     ----------
#     intervals : np.ndarray [shape=(n, 2)]
#         set of time intervals
# 
#     Returns
#     -------
#     valid : bool
#         True if ``intervals`` passes validation.
#     """
# 
#     if intervals.ndim != 2 or intervals.shape[-1] != 2:
#         raise ParameterError("intervals must have shape (n, 2)")
# 
#     if np.any(intervals[:, 0] > intervals[:, 1]):
#         raise ParameterError(
#             "intervals={} must have non-negative durations".format(intervals)
#         )
# 
#     return True


import numpy as np
import numba
from .exceptions import ParameterError
from .utils import valid_intervals
    ------
    ParameterError
        If either array of input intervals is not the correct shape

        If ``strict=True`` and some element of ``intervals_from`` is disjoint from
        every element of ``intervals_to``.

    Examples
    --------
    >>> ints_from = np.array([[3, 5], [1, 4], [4, 5]])
    >>> ints_to = np.array([[0, 2], [1, 3], [4, 5], [6, 7]])
    >>> librosa.util.match_intervals(ints_from, ints_to)
    array([2, 1, 2], dtype=uint32)
    >>> # [3, 5] => [4, 5]  (ints_to[2])
    >>> # [1, 4] => [1, 3]  (ints_to[1])
    >>> # [4, 5] => [4, 5]  (ints_to[2])

    The reverse matching of the above is not possible in ``strict`` mode
    because ``[6, 7]`` is disjoint from all intervals in ``ints_from``.
    With ``strict=False``, we get the following:

    >>> librosa.util.match_intervals(ints_to, ints_from, strict=False)
    array([1, 1, 2, 2], dtype=uint32)
    >>> # [0, 2] => [1, 4]  (ints_from[1])
    >>> # [1, 3] => [1, 4]  (ints_from[1])
    >>> # [4, 5] => [4, 5]  (ints_from[2])
    >>> # [6, 7] => [4, 5]  (ints_from[2])
    """

    if len(intervals_from) == 0 or len(intervals_to) == 0:

# Path: librosa/util/exceptions.py
# class ParameterError(LibrosaError):
#     """Exception class for mal-formed inputs"""
# 
#     pass
# 
# Path: librosa/util/utils.py
# def valid_intervals(intervals):
#     """Ensure that an array is a valid representation of time intervals:
# 
#         - intervals.ndim == 2
#         - intervals.shape[1] == 2
#         - intervals[i, 0] <= intervals[i, 1] for all i
# 
#     Parameters
#     ----------
#     intervals : np.ndarray [shape=(n, 2)]
#         set of time intervals
# 
#     Returns
#     -------
#     valid : bool
#         True if ``intervals`` passes validation.
#     """
# 
#     if intervals.ndim != 2 or intervals.shape[-1] != 2:
#         raise ParameterError("intervals must have shape (n, 2)")
# 
#     if np.any(intervals[:, 0] > intervals[:, 1]):
#         raise ParameterError(
#             "intervals={} must have non-negative durations".format(intervals)
#         )
# 
#     return True


# Path: librosa/util/matching.py
import numpy as np
import numba
from .exceptions import ParameterError
from .utils import valid_intervals

    ------
    ParameterError
        If either array of input intervals is not the correct shape

        If ``strict=True`` and some element of ``intervals_from`` is disjoint from
        every element of ``intervals_to``.

    Examples
    --------
    >>> ints_from = np.array([[3, 5], [1, 4], [4, 5]])
    >>> ints_to = np.array([[0, 2], [1, 3], [4, 5], [6, 7]])
    >>> librosa.util.match_intervals(ints_from, ints_to)
    array([2, 1, 2], dtype=uint32)
    >>> # [3, 5] => [4, 5]  (ints_to[2])
    >>> # [1, 4] => [1, 3]  (ints_to[1])
    >>> # [4, 5] => [4, 5]  (ints_to[2])

    The reverse matching of the above is not possible in ``strict`` mode
    because ``[6, 7]`` is disjoint from all intervals in ``ints_from``.
    With ``strict=False``, we get the following:

    >>> librosa.util.match_intervals(ints_to, ints_from, strict=False)
    array([1, 1, 2, 2], dtype=uint32)
    >>> # [0, 2] => [1, 4]  (ints_from[1])
    >>> # [1, 3] => [1, 4]  (ints_from[1])
    >>> # [4, 5] => [4, 5]  (ints_from[2])
    >>> # [6, 7] => [4, 5]  (ints_from[2])
    """

    if len(intervals_from) == 0 or len(intervals_to) == 0:

        raise ParameterError("Attempting to match empty interval list")