[resampy] Add stubs for resampy 0.4.3 (#15341)

This commit is contained in:
Hunter Hogan
2026-03-09 08:18:08 -05:00
committed by GitHub
parent bfb7342f83
commit a1c4ca3d8b
6 changed files with 74 additions and 0 deletions
@@ -0,0 +1,2 @@
# Part of internal API which is not needed for public type stubs:
resampy.interpn
+4
View File
@@ -0,0 +1,4 @@
version = "0.4.*"
upstream_repository = "https://github.com/bmcfee/resampy"
# Requires a version of numpy with a `py.typed` file
requires = ["numpy>=1.20"]
+2
View File
@@ -0,0 +1,2 @@
from . import filters as filters
from .core import *
+36
View File
@@ -0,0 +1,36 @@
from collections.abc import Callable
from typing import Any
from typing_extensions import TypeAlias, TypeVar
import numpy as np
__all__ = ["resample", "resample_nu"]
# np.floating[Any] because precision is not important
_FloatArray = TypeVar("_FloatArray", bound=np.ndarray[tuple[int, ...], np.dtype[np.floating[Any]]])
_FilterType: TypeAlias = str | Callable[[int], np.ndarray[tuple[int], np.dtype[np.float64]]]
def resample(
x: _FloatArray,
sr_orig: float,
sr_new: float,
axis: int = -1,
filter: _FilterType = "kaiser_best",
parallel: bool = False,
*,
num_zeros: int = 64,
precision: int = 9,
rolloff: float = 0.945,
) -> _FloatArray: ...
def resample_nu(
x: _FloatArray,
sr_orig: float,
t_out: _FloatArray,
axis: int = -1,
filter: _FilterType = "kaiser_best",
parallel: bool = False,
*,
num_zeros: int = 64,
precision: int = 9,
rolloff: float = 0.945,
) -> _FloatArray: ...
+26
View File
@@ -0,0 +1,26 @@
from collections.abc import Callable
from typing_extensions import TypeAlias
import numpy as np
__all__ = ["get_filter", "clear_cache", "sinc_window"]
# Dictionary to cache loaded filters
FILTER_CACHE: dict[str, tuple[np.ndarray[tuple[int], np.dtype[np.float64]], int, float]]
# List of filter functions available
FILTER_FUNCTIONS: list[str]
_FilterType: TypeAlias = str | Callable[[int], np.ndarray[tuple[int], np.dtype[np.float64]]]
def sinc_window(
num_zeros: int = 64,
precision: int = 9,
window: Callable[[int], np.ndarray[tuple[int], np.dtype[np.float64]]] | None = None,
rolloff: float = 0.945,
) -> tuple[np.ndarray[tuple[int], np.dtype[np.float64]], int, float]: ...
def get_filter(
name_or_function: _FilterType, *, num_zeros: int = 64, precision: int = 9, rolloff: float = 0.945
) -> tuple[np.ndarray[tuple[int], np.dtype[np.float64]], int, float]: ...
def load_filter(filter_name: str) -> tuple[np.ndarray[tuple[int], np.dtype[np.float64]], int, float]: ...
def clear_cache() -> None: ...
+4
View File
@@ -0,0 +1,4 @@
from typing import Final
short_version: Final[str]
version: Final[str]