mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 12:35:49 +08:00
[resampy] Add stubs for resampy 0.4.3 (#15341)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# Part of internal API which is not needed for public type stubs:
|
||||
resampy.interpn
|
||||
@@ -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"]
|
||||
@@ -0,0 +1,2 @@
|
||||
from . import filters as filters
|
||||
from .core import *
|
||||
@@ -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: ...
|
||||
@@ -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: ...
|
||||
@@ -0,0 +1,4 @@
|
||||
from typing import Final
|
||||
|
||||
short_version: Final[str]
|
||||
version: Final[str]
|
||||
Reference in New Issue
Block a user