Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0fb9f63
Add initial stubs for resampy including core functionality and metadata
hunterhogan Jan 29, 2026
547b4c4
Merge branch 'main' of https://github.com/python/typeshed into resampy
hunterhogan Jan 29, 2026
c910ff9
METADATA: add requires
hunterhogan Jan 29, 2026
4f8383c
Update stubs/resampy/METADATA.toml
hunterhogan Jan 31, 2026
3b0c8f8
Update stubs/resampy/resampy/version.pyi
hunterhogan Jan 31, 2026
2801ee4
Update stubs/resampy/resampy/__init__.pyi
hunterhogan Jan 31, 2026
541d8e8
Update stubs/resampy/resampy/filters.pyi
hunterhogan Jan 31, 2026
52b6063
Update stubs/resampy/resampy/interpn.pyi
hunterhogan Jan 31, 2026
a6ecd3c
Update stubs/resampy/resampy/interpn.pyi
hunterhogan Jan 31, 2026
d0405af
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 31, 2026
e1c3fd0
Create stubtest_allowlist.txt
hunterhogan Jan 31, 2026
1f86e17
Update stubs/resampy/resampy/core.pyi
hunterhogan Feb 1, 2026
e6c29a6
Update stubs/resampy/resampy/filters.pyi
hunterhogan Feb 1, 2026
930e971
Update stubs/resampy/resampy/interpn.pyi
hunterhogan Feb 1, 2026
7158cef
Update stubs/resampy/resampy/interpn.pyi
hunterhogan Feb 1, 2026
48f3996
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 1, 2026
bbbbbd5
Update stubs/resampy/resampy/interpn.pyi
hunterhogan Feb 1, 2026
5796fde
Better filter typing. Real kwargs types.
hunterhogan Feb 1, 2026
84782b7
Remove internal API: `_resample_loop`.
hunterhogan Feb 1, 2026
f308524
Remove internal API.
hunterhogan Feb 1, 2026
33ff8f9
Update stubs/resampy/@tests/stubtest_allowlist.txt
hunterhogan Feb 2, 2026
6f07d59
Delete internal API file.
hunterhogan Feb 2, 2026
75f0d8e
Update stubs/resampy/resampy/core.pyi
hunterhogan Feb 2, 2026
3165fa5
Update stubs/resampy/resampy/core.pyi
hunterhogan Feb 2, 2026
b78f101
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2026
fa83b83
Refactor resample and resample_nu functions to use default parameter …
hunterhogan Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stubs/resampy/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Part of internal API which is not needed for public type stubs:
resampy.interpn
4 changes: 4 additions & 0 deletions stubs/resampy/METADATA.toml
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions stubs/resampy/resampy/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import filters as filters
from .core import *
38 changes: 38 additions & 0 deletions stubs/resampy/resampy/core.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from collections.abc import Callable
from typing import Any
from typing_extensions import TypeAlias, TypeVar

import numpy as np

__all__ = ["resample", "resample_nu"]

_FloatArray = TypeVar("_FloatArray", bound=np.ndarray[tuple[int, ...], np.dtype[np.floating[Any]]])

# np.floating[Any] because precision is not important

_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 changes: 26 additions & 0 deletions stubs/resampy/resampy/filters.pyi
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions stubs/resampy/resampy/version.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from typing import Final

short_version: Final[str]
version: Final[str]
Loading