diff --git a/pyproject.toml b/pyproject.toml index 49fb7bde..4d185beb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,6 +85,7 @@ cmd = """ stubtest --mypy-config-file=pyproject.toml --allowlist=tests/stubtest/allowlist.txt + --ignore-unused-allowlist $modules """ args = [{name = "modules", positional = true, multiple = true, default = "scipy"}] diff --git a/scipy-stubs/_lib/_util.pyi b/scipy-stubs/_lib/_util.pyi index 0a3d4274..01586305 100644 --- a/scipy-stubs/_lib/_util.pyi +++ b/scipy-stubs/_lib/_util.pyi @@ -7,12 +7,6 @@ import numpy as np import numpy.typing as npt import optype.numpy as onpt from numpy._typing import _ArrayLikeInt -from numpy.exceptions import ( - AxisError as AxisError, - ComplexWarning as ComplexWarning, - DTypePromotionError as DTypePromotionError, - VisibleDeprecationWarning as VisibleDeprecationWarning, -) from numpy.random import Generator as Generator # noqa: ICN003 from scipy._typing import RNG, EnterSelfMixin, Seed @@ -23,6 +17,8 @@ _VT = TypeVar("_VT") _RT = TypeVar("_RT") _AxisT = TypeVar("_AxisT", bound=int | np.integer[Any]) +### + np_long: Final[type[np.int32 | np.int64]] = ... np_ulong: Final[type[np.uint32 | np.uint64]] = ... copy_if_needed: Final[bool | None] = ... @@ -30,6 +26,18 @@ copy_if_needed: Final[bool | None] = ... IntNumber: TypeAlias = int | np.integer[Any] DecimalNumber: TypeAlias = float | np.floating[Any] | np.integer[Any] +class ComplexWarning(RuntimeWarning): ... +class VisibleDeprecationWarning(UserWarning): ... +class DTypePromotionError(TypeError): ... + +class AxisError(ValueError, IndexError): + axis: None | int + ndim: None | int + @overload + def __init__(self, /, axis: str, ndim: None = None, msg_prefix: None = None) -> None: ... + @overload + def __init__(self, /, axis: int, ndim: int, msg_prefix: str | None = None) -> None: ... + class FullArgSpec(NamedTuple): args: Sequence[str] varargs: str | None diff --git a/scipy-stubs/fftpack/helper.pyi b/scipy-stubs/fftpack/helper.pyi index 38541110..fce56afb 100644 --- a/scipy-stubs/fftpack/helper.pyi +++ b/scipy-stubs/fftpack/helper.pyi @@ -1,4 +1,5 @@ # This module is not meant for public use and will be removed in SciPy v2.0.0. +import sys from typing import Final from typing_extensions import deprecated @@ -6,8 +7,14 @@ __all__ = ["fftfreq", "fftshift", "ifftshift", "next_fast_len", "rfftfreq"] __MESSAGE: Final = "will be removed in SciPy v2.0.0" -@deprecated(__MESSAGE) -def fftfreq(n: object, d: object = ..., device: object = ...) -> object: ... +if sys.version_info >= (3, 13): + # `device` was added in numpy 2 + @deprecated(__MESSAGE) + def fftfreq(n: object, d: object = ..., device: object = ...) -> object: ... +else: + @deprecated(__MESSAGE) + def fftfreq(n: object, d: object = ...) -> object: ... + @deprecated(__MESSAGE) def fftshift(x: object, axes: object = ...) -> object: ... @deprecated(__MESSAGE) diff --git a/scipy-stubs/integrate/_quad_vec.pyi b/scipy-stubs/integrate/_quad_vec.pyi index c7148c3a..7e20a2d2 100644 --- a/scipy-stubs/integrate/_quad_vec.pyi +++ b/scipy-stubs/integrate/_quad_vec.pyi @@ -13,7 +13,7 @@ _S = TypeVar("_S") _T = TypeVar("_T") _VT = TypeVar("_VT", default=object) -_FloatND: TypeAlias = np.ndarray[tuple[int, ...], np.dtype[np.floating[Any]]] | float | np.floating[Any] +_FloatND: TypeAlias = np.ndarray[Any, np.dtype[np.floating[Any]]] | float | np.floating[Any] _NDT_f = TypeVar("_NDT_f", bound=_FloatND) _NDT_f_co = TypeVar("_NDT_f_co", bound=_FloatND, covariant=True, default=_FloatND) _SCT_f_co = TypeVar("_SCT_f_co", bound=np.floating[Any], covariant=True, default=np.float64) @@ -147,7 +147,7 @@ def quad_vec( ) -> tuple[np.floating[_NBT], float, _Bunch[np.floating[_NBT]]]: ... @overload def quad_vec( - f: _QuadVecFunc[onpt.Array[_ShapeT, np.floating[_NBT]], Unpack[_Ts]], + f: _QuadVecFunc[np.ndarray[_ShapeT, np.dtype[np.floating[_NBT]]], Unpack[_Ts]], a: float, b: float, epsabs: float = 1e-200, diff --git a/scipy-stubs/io/matlab/_mio5_params.pyi b/scipy-stubs/io/matlab/_mio5_params.pyi index 4fdf926c..0ab4eddb 100644 --- a/scipy-stubs/io/matlab/_mio5_params.pyi +++ b/scipy-stubs/io/matlab/_mio5_params.pyi @@ -53,7 +53,8 @@ __all__ = [ "mxUINT64_CLASS", ] -_ShapeT_co = TypeVar("_ShapeT_co", covariant=True, bound=tuple[int, ...], default=tuple[int, ...]) +# NOTE: explicit covariance can't be used, because shape types are invariant in `numpy<2.1` +_ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...], default=tuple[int, ...]) @type_check_only class _CodecTemplateValue(TypedDict): @@ -141,7 +142,7 @@ _MXName: TypeAlias = Literal[ MDTYPES: Final[_MDTypes] = ... NP_TO_MTYPES: Final[_NP2M] = ... NP_TO_MXTYPES: Final[_NP2MX] = ... -# TODO: use `np.dtypes.VoidDType[Literal[32]]` once we have `numpy >= 2.1.0` +# TODO(jorenham): use `np.dtypes.VoidDType[Literal[32]]` once we have `numpy >= 2.1.0` OPAQUE_DTYPE: Final[np.dtype[np.void]] = ... codecs_template: Final[_CodecsTemplate] = ... @@ -187,18 +188,18 @@ mxOBJECT_CLASS_FROM_MATRIX_H: Final[_MXType] = 18 @final class mat_struct: ... -class MatlabObject(np.ndarray[_ShapeT_co, np.dtype[np.void]], Generic[_ShapeT_co]): +class MatlabObject(np.ndarray[_ShapeT, np.dtype[np.void]], Generic[_ShapeT]): classname: Final[str | None] def __new__(cls, input_array: onpt.AnyVoidArray, classname: str | None = None) -> Self: ... @override def __array_finalize__(self, /, obj: None | npt.NDArray[np.void]) -> None: ... -class MatlabFunction(np.ndarray[_ShapeT_co, np.dtype[np.void]], Generic[_ShapeT_co]): +class MatlabFunction(np.ndarray[_ShapeT, np.dtype[np.void]], Generic[_ShapeT]): @override def __new__(cls, input_array: onpt.AnyVoidArray) -> Self: ... -class MatlabOpaque(np.ndarray[_ShapeT_co, np.dtype[np.void]], Generic[_ShapeT_co]): +class MatlabOpaque(np.ndarray[_ShapeT, np.dtype[np.void]], Generic[_ShapeT]): @override def __new__(cls, input_array: onpt.AnyVoidArray) -> Self: ... diff --git a/scipy-stubs/linalg/_special_matrices.pyi b/scipy-stubs/linalg/_special_matrices.pyi index 2993abe4..4aef5b1c 100644 --- a/scipy-stubs/linalg/_special_matrices.pyi +++ b/scipy-stubs/linalg/_special_matrices.pyi @@ -1,7 +1,9 @@ from typing import Literal, TypeAlias, overload +from typing_extensions import TypeVar import numpy as np import numpy.typing as npt +import optype.numpy as onpt import scipy._typing as spt __all__ = [ @@ -24,42 +26,43 @@ __all__ = [ "toeplitz", ] -_Array_2d: TypeAlias = np.ndarray[tuple[int, int], np.dtype[np.generic]] -_Array_O_2d: TypeAlias = np.ndarray[tuple[int, int], np.dtypes.ObjectDType] -_Array_u8_2d: TypeAlias = np.ndarray[tuple[int, int], np.dtypes.UInt64DType] -_Array_i8_2d: TypeAlias = np.ndarray[tuple[int, int], np.dtypes.Int64DType] -_Array_f8_2d: TypeAlias = np.ndarray[tuple[int, int], np.dtypes.Float64DType] -_Array_c16_2d: TypeAlias = np.ndarray[tuple[int, int], np.dtypes.Complex128DType] +_SCT = TypeVar("_SCT", bound=np.generic, default=np.generic) -_SymmetryKind: TypeAlias = Literal["symmetric", "upper", "lower"] +_Matrix: TypeAlias = onpt.Array[tuple[int, int], _SCT] +_Kind: TypeAlias = Literal["symmetric", "upper", "lower"] -def toeplitz(c: npt.ArrayLike, r: npt.ArrayLike | None = None) -> _Array_2d: ... -def circulant(c: npt.ArrayLike) -> _Array_2d: ... -def hankel(c: npt.ArrayLike, r: npt.ArrayLike | None = None) -> _Array_2d: ... -def hadamard(n: spt.AnyInt, dtype: npt.DTypeLike = ...) -> _Array_2d: ... -def leslie(f: npt.ArrayLike, s: npt.ArrayLike) -> _Array_2d: ... -def kron(a: npt.ArrayLike, b: npt.ArrayLike) -> _Array_2d: ... -def block_diag(*arrs: npt.ArrayLike) -> _Array_2d: ... -def companion(a: npt.ArrayLike) -> _Array_2d: ... -def helmert(n: spt.AnyInt, full: bool = False) -> _Array_f8_2d: ... -def hilbert(n: spt.AnyInt) -> _Array_f8_2d: ... +### + +# TODO(jorenham): transparent dtypes +def toeplitz(c: npt.ArrayLike, r: npt.ArrayLike | None = None) -> _Matrix: ... +def circulant(c: npt.ArrayLike) -> _Matrix: ... +def hankel(c: npt.ArrayLike, r: npt.ArrayLike | None = None) -> _Matrix: ... +def hadamard(n: spt.AnyInt, dtype: npt.DTypeLike = ...) -> _Matrix: ... +def leslie(f: npt.ArrayLike, s: npt.ArrayLike) -> _Matrix: ... +def kron(a: npt.ArrayLike, b: npt.ArrayLike) -> _Matrix: ... +def block_diag(*arrs: npt.ArrayLike) -> _Matrix: ... +def companion(a: npt.ArrayLike) -> _Matrix: ... +def helmert(n: spt.AnyInt, full: bool = False) -> _Matrix[np.float64]: ... +def hilbert(n: spt.AnyInt) -> _Matrix[np.float64]: ... +def fiedler(a: npt.ArrayLike) -> _Matrix: ... +def fiedler_companion(a: npt.ArrayLike) -> _Matrix: ... +def convolution_matrix(a: npt.ArrayLike, n: spt.AnyInt, mode: spt.CorrelateMode = "full") -> _Matrix: ... + +# @overload -def invhilbert(n: spt.AnyInt, exact: Literal[False] = False) -> _Array_f8_2d: ... +def invhilbert(n: spt.AnyInt, exact: Literal[False] = False) -> _Matrix[np.float64]: ... @overload -def invhilbert(n: spt.AnyInt, exact: Literal[True]) -> _Array_i8_2d | _Array_O_2d: ... +def invhilbert(n: spt.AnyInt, exact: Literal[True]) -> _Matrix[np.int64] | _Matrix[np.object_]: ... @overload -def pascal(n: spt.AnyInt, kind: _SymmetryKind = "symmetric", exact: Literal[True] = True) -> _Array_u8_2d | _Array_O_2d: ... +def pascal(n: spt.AnyInt, kind: _Kind = "symmetric", exact: Literal[True] = True) -> _Matrix[np.uint64 | np.object_]: ... @overload -def pascal(n: spt.AnyInt, kind: _SymmetryKind = "symmetric", *, exact: Literal[False]) -> _Array_f8_2d: ... +def pascal(n: spt.AnyInt, kind: _Kind = "symmetric", *, exact: Literal[False]) -> _Matrix[np.float64]: ... @overload -def pascal(n: spt.AnyInt, kind: _SymmetryKind, exact: Literal[False]) -> _Array_f8_2d: ... +def pascal(n: spt.AnyInt, kind: _Kind, exact: Literal[False]) -> _Matrix[np.float64]: ... @overload -def invpascal(n: spt.AnyInt, kind: _SymmetryKind = "symmetric", exact: Literal[True] = True) -> _Array_i8_2d | _Array_O_2d: ... +def invpascal(n: spt.AnyInt, kind: _Kind = "symmetric", exact: Literal[True] = True) -> _Matrix[np.int64 | np.object_]: ... @overload -def invpascal(n: spt.AnyInt, kind: _SymmetryKind = "symmetric", *, exact: Literal[False]) -> _Array_f8_2d: ... +def invpascal(n: spt.AnyInt, kind: _Kind = "symmetric", *, exact: Literal[False]) -> _Matrix[np.float64]: ... @overload -def invpascal(n: spt.AnyInt, kind: _SymmetryKind, exact: Literal[False]) -> _Array_f8_2d: ... -def dft(n: spt.AnyInt, scale: Literal["sqrtn", "n"] | None = None) -> _Array_c16_2d: ... -def fiedler(a: npt.ArrayLike) -> _Array_2d: ... -def fiedler_companion(a: npt.ArrayLike) -> _Array_2d: ... -def convolution_matrix(a: npt.ArrayLike, n: spt.AnyInt, mode: spt.CorrelateMode = "full") -> _Array_2d: ... +def invpascal(n: spt.AnyInt, kind: _Kind, exact: Literal[False]) -> _Matrix[np.float64]: ... +def dft(n: spt.AnyInt, scale: Literal["sqrtn", "n"] | None = None) -> _Matrix[np.complex128]: ... diff --git a/scipy-stubs/linalg/blas.pyi b/scipy-stubs/linalg/blas.pyi index 86a5d475..fe933475 100644 --- a/scipy-stubs/linalg/blas.pyi +++ b/scipy-stubs/linalg/blas.pyi @@ -7,19 +7,19 @@ import scipy._typing as spt __all__ = ["find_best_blas_type", "get_blas_funcs"] +# see `scipy.linalg.blas._type_conv` def find_best_blas_type( arrays: Sequence[npt.NDArray[np.generic]] = (), dtype: npt.DTypeLike | None = None, ) -> ( - # see `scipy.linalg.blas._type_conv` - tuple[Literal["s"], np.dtypes.Float32DType, bool] - | tuple[Literal["f"], np.dtypes.Float64DType, bool] - | tuple[Literal["c"], np.dtypes.Complex64DType, bool] - | tuple[Literal["z"], np.dtypes.Complex128DType, bool] + tuple[Literal["s"], np.dtype[np.float32], bool] + | tuple[Literal["f"], np.dtype[np.float64], bool] + | tuple[Literal["c"], np.dtype[np.complex64], bool] + | tuple[Literal["z"], np.dtype[np.complex128], bool] ): ... def get_blas_funcs( names: Iterable[str] | str, arrays: Sequence[npt.NDArray[np.generic]] = (), dtype: npt.DTypeLike | None = None, - ilp64: Literal[True, False, "preferred"] = False, + ilp64: Literal[False, True, "preferred"] = False, ) -> list[spt._FortranFunction] | spt._FortranFunction: ... diff --git a/scipy-stubs/signal/_bsplines.pyi b/scipy-stubs/signal/_bsplines.pyi index 02c5092a..75ffa49e 100644 --- a/scipy-stubs/signal/_bsplines.pyi +++ b/scipy-stubs/signal/_bsplines.pyi @@ -8,15 +8,15 @@ from scipy._typing import AnyInt, AnyReal __all__ = ["cspline1d", "cspline1d_eval", "gauss_spline", "qspline1d", "qspline1d_eval", "spline_filter"] -_SCT_fc = TypeVar("_SCT_fc", np.float64, np.float32, np.complex128, np.complex64) +_SCT_fc = TypeVar("_SCT_fc", bound=np.inexact[Any]) @overload def gauss_spline(x: _ArrayLikeInt_co, n: AnyInt) -> npt.NDArray[np.float64]: ... @overload -def gauss_spline(x: _ArrayLike[_SCT_fc], n: AnyInt) -> npt.NDArray[_SCT_fc]: ... -@overload def gauss_spline(x: _ArrayLikeFloat_co, n: AnyInt) -> npt.NDArray[np.floating[Any]]: ... @overload +def gauss_spline(x: _ArrayLike[_SCT_fc], n: AnyInt) -> npt.NDArray[_SCT_fc]: ... +@overload def gauss_spline(x: _ArrayLikeComplex_co, n: AnyInt) -> npt.NDArray[np.inexact[Any]]: ... def spline_filter(Iin: _ArrayLike[_SCT_fc], lmbda: AnyReal = 5.0) -> npt.NDArray[_SCT_fc]: ... def cspline1d(signal: npt.NDArray[_SCT_fc], lamb: AnyReal = 0.0) -> npt.NDArray[_SCT_fc]: ... diff --git a/scipy-stubs/sparse/bsr.pyi b/scipy-stubs/sparse/bsr.pyi index c90459b1..3db58b31 100644 --- a/scipy-stubs/sparse/bsr.pyi +++ b/scipy-stubs/sparse/bsr.pyi @@ -1,4 +1,5 @@ # This module is not meant for public use and will be removed in SciPy v2.0.0. +import sys from typing_extensions import deprecated __all__ = [ @@ -57,15 +58,20 @@ def bsr_transpose(*args: object, **kwargs: object) -> object: ... def csr_matmat_maxnnz(*args: object, **kwargs: object) -> object: ... @deprecated("will be removed in SciPy v2.0.0") def isspmatrix_bsr(x: object) -> object: ... -@deprecated("will be removed in SciPy v2.0.0") -def warn( - message: object, - category: object = ..., - stacklevel: object = ..., - source: object = ..., - *, - skip_file_prefixes: object = ..., -) -> None: ... + +if sys.version_info >= (3, 12): + @deprecated("will be removed in SciPy v2.0.0") + def warn( + message: object, + category: object = ..., + stacklevel: object = ..., + source: object = ..., + *, + skip_file_prefixes: object = ..., + ) -> None: ... +else: + @deprecated("will be removed in SciPy v2.0.0") + def warn(message: object, category: object = ..., stacklevel: object = ..., source: object = ...) -> None: ... # sputils @deprecated("will be removed in SciPy v2.0.0") diff --git a/scipy-stubs/sparse/compressed.pyi b/scipy-stubs/sparse/compressed.pyi index 7f93e6e3..7f0c1c9b 100644 --- a/scipy-stubs/sparse/compressed.pyi +++ b/scipy-stubs/sparse/compressed.pyi @@ -1,5 +1,6 @@ # This module is not meant for public use and will be removed in SciPy v2.0.0. import operator +import sys from typing_extensions import deprecated __all__ = [ @@ -37,15 +38,20 @@ class IndexMixin: def __getitem__(self, key: object, /) -> object: ... def __setitem__(self, key: object, x: object, /) -> None: ... -@deprecated("will be removed in SciPy v2.0.0") -def warn( - message: object, - category: object = ..., - stacklevel: object = ..., - source: object = ..., - *, - skip_file_prefixes: object = ..., -) -> None: ... +if sys.version_info >= (3, 12): + @deprecated("will be removed in SciPy v2.0.0") + def warn( + message: object, + category: object = ..., + stacklevel: object = ..., + source: object = ..., + *, + skip_file_prefixes: object = ..., + ) -> None: ... +else: + @deprecated("will be removed in SciPy v2.0.0") + def warn(message: object, category: object = ..., stacklevel: object = ..., source: object = ...) -> None: ... + @deprecated("will be removed in SciPy v2.0.0") def csr_column_index1(*args: object, **kwargs: object) -> object: ... @deprecated("will be removed in SciPy v2.0.0") diff --git a/scipy-stubs/sparse/coo.pyi b/scipy-stubs/sparse/coo.pyi index 69f1db74..4318c5fd 100644 --- a/scipy-stubs/sparse/coo.pyi +++ b/scipy-stubs/sparse/coo.pyi @@ -1,5 +1,6 @@ # This module is not meant for public use and will be removed in SciPy v2.0.0. import operator +import sys from typing import type_check_only from typing_extensions import deprecated @@ -55,15 +56,20 @@ def coo_matvec(*args: object, **kwargs: object) -> object: ... def coo_tocsr(*args: object, **kwargs: object) -> object: ... @deprecated("will be removed in SciPy v2.0.0") def coo_todense(*args: object, **kwargs: object) -> object: ... -@deprecated("will be removed in SciPy v2.0.0") -def warn( - message: object, - category: object = ..., - stacklevel: object = ..., - source: object = ..., - *, - skip_file_prefixes: object = ..., -) -> None: ... + +if sys.version_info >= (3, 12): + @deprecated("will be removed in SciPy v2.0.0") + def warn( + message: object, + category: object = ..., + stacklevel: object = ..., + source: object = ..., + *, + skip_file_prefixes: object = ..., + ) -> None: ... +else: + @deprecated("will be removed in SciPy v2.0.0") + def warn(message: object, category: object = ..., stacklevel: object = ..., source: object = ...) -> None: ... # sputils @type_check_only diff --git a/scipy-stubs/special/_basic.pyi b/scipy-stubs/special/_basic.pyi index 15af2b85..c718e6a0 100644 --- a/scipy-stubs/special/_basic.pyi +++ b/scipy-stubs/special/_basic.pyi @@ -9,7 +9,6 @@ from typing_extensions import TypeVar import numpy as np import numpy.typing as npt import optype.numpy as onpt -from numpy import sinc # noqa: ICN003 from numpy._typing import _ArrayLikeComplex_co, _ArrayLikeFloat_co, _ArrayLikeInt_co # don't try this at home, kids import scipy._typing as spt from ._ufuncs import psi as digamma # completely different greek letters, but oh well... @@ -77,13 +76,14 @@ __all__ = [ ] _T0 = TypeVar("_T0") -_T1 = TypeVar("_T1", default=_T0) +_T1 = TypeVar("_T1") _tuple2: TypeAlias = tuple[_T0, _T0] _tuple4: TypeAlias = tuple[_T0, _T1, _T1, _T1] _tuple8: TypeAlias = tuple[_T0, _T1, _T1, _T1, _T1, _T1, _T1, _T1] _ArrayT = TypeVar("_ArrayT", bound=onpt.Array) _SCT = TypeVar("_SCT", bound=np.generic) +_SCT_fc = TypeVar("_SCT_fc", bound=np.inexact[Any]) _scalar_or_array: TypeAlias = _SCT | onpt.Array[tuple[int, ...], _SCT] _array_0d: TypeAlias = onpt.Array[tuple[()], _SCT] _array_1d: TypeAlias = onpt.Array[tuple[int], _SCT] @@ -105,9 +105,21 @@ _c8: TypeAlias = np.complex64 _c16: TypeAlias = np.complex128 _c: TypeAlias = _c8 | _c16 | np.clongdouble +@overload +def sinc(x: np.integer[Any] | np.bool_) -> np.float64: ... +@overload +def sinc(x: _SCT_fc) -> _SCT_fc: ... +@overload +def sinc(x: npt.NDArray[np.integer[Any] | np.bool_]) -> npt.NDArray[np.float64]: ... +@overload +def sinc(x: npt.NDArray[_SCT_fc]) -> npt.NDArray[_SCT_fc]: ... +@overload +def sinc(x: _ArrayLikeFloat_co) -> np.floating[Any] | npt.NDArray[np.floating[Any]]: ... +@overload +def sinc(x: _ArrayLikeComplex_co) -> np.inexact[Any] | npt.NDArray[np.inexact[Any]]: ... def diric(x: _ArrayLikeFloat_co, n: spt.AnyInt) -> npt.NDArray[np.floating[Any]]: ... def jnjnp_zeros(nt: spt.AnyInt) -> _tuple4[_array_1d[_f8], _array_1d[_i4]]: ... -def jnyn_zeros(n: spt.AnyInt, nt: spt.AnyInt) -> _tuple4[_array_1d[_f8]]: ... +def jnyn_zeros(n: spt.AnyInt, nt: spt.AnyInt) -> _tuple4[_array_1d[_f8], _array_1d[_f8]]: ... def jn_zeros(n: spt.AnyInt, nt: spt.AnyInt) -> _array_1d[_f8]: ... def jnp_zeros(n: spt.AnyInt, nt: spt.AnyInt) -> _array_1d[_f8]: ... def yn_zeros(n: spt.AnyInt, nt: spt.AnyInt) -> _array_1d[_f8]: ... @@ -138,8 +150,8 @@ def bernoulli(n: spt.AnyInt) -> _array_1d[_f8]: ... def euler(n: spt.AnyInt) -> _array_1d[_f8]: ... def lpn(n: spt.AnyInt, z: spt.AnyReal) -> _tuple2[_array_1d[_f]] | _tuple2[_array_1d[_c]]: ... # the dtype propagates def lqn(n: spt.AnyInt, z: npt.ArrayLike) -> _tuple2[_array_1d[_f8]] | _tuple2[_array_1d[_c16]]: ... # either f8 or c16 -def ai_zeros(nt: spt.AnyInt) -> _tuple4[_array_1d[_f8]]: ... -def bi_zeros(nt: spt.AnyInt) -> _tuple4[_array_1d[_f8]]: ... +def ai_zeros(nt: spt.AnyInt) -> _tuple4[_array_1d[_f8], _array_1d[_f8]]: ... +def bi_zeros(nt: spt.AnyInt) -> _tuple4[_array_1d[_f8], _array_1d[_f8]]: ... def lmbda(v: spt.AnyReal, x: spt.AnyReal) -> _tuple2[_array_1d[_f8]]: ... def pbdv_seq(v: spt.AnyReal, x: spt.AnyReal) -> _tuple2[_array_1d[_f8]]: ... def pbvv_seq(v: spt.AnyReal, x: spt.AnyReal) -> _tuple2[_array_1d[_f8]]: ... @@ -152,7 +164,7 @@ def berp_zeros(nt: spt.AnyInt) -> _array_1d[_f8]: ... def beip_zeros(nt: spt.AnyInt) -> _array_1d[_f8]: ... def kerp_zeros(nt: spt.AnyInt) -> _array_1d[_f8]: ... def keip_zeros(nt: spt.AnyInt) -> _array_1d[_f8]: ... -def kelvin_zeros(nt: spt.AnyInt) -> _tuple8[_array_1d[_f8]]: ... +def kelvin_zeros(nt: spt.AnyInt) -> _tuple8[_array_1d[_f8], _array_1d[_f8]]: ... def pro_cv_seq(m: spt.AnyInt, n: spt.AnyInt, c: spt.AnyReal) -> _array_1d[_f8]: ... def obl_cv_seq(m: spt.AnyInt, n: spt.AnyInt, c: spt.AnyReal) -> _array_1d[_f8]: ... @overload diff --git a/tests/stubtest/allowlist.txt b/tests/stubtest/allowlist.txt index 259bdc44..badb1bab 100644 --- a/tests/stubtest/allowlist.txt +++ b/tests/stubtest/allowlist.txt @@ -23,3 +23,7 @@ scipy\._lib\._array_api\.(Array|ArrayLike) # these exist, but in `if TYPE_CHECK scipy\._lib\._ccallback\.PyCFuncPtr # this exists, but under `if TYPE_CHECKING: ...` scipy\.signal\._short_time_fft\.(FFT_MODE_TYPE|PAD_TYPE) # `Literal[...] != def (*, **)` scipy\.(_lib|integrate|stats)\.((_|\w)+\.)+__replace__ # `NamedTuple` on `python >= 3.13` + +# stubtest doesn't understand `if sys.version_info >= _: ...` blocks +scipy\.fftpack\.helper\.fftfreq +scipy\.sparse\.(\w+)\.warn