From a2371bceba8b91611f05abd8da354bb1c6d0f202 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 22 Oct 2024 23:55:45 -0400 Subject: [PATCH] Use scipy-stubs (#304) --- mypy.ini | 5 -- scripts/requirements-dev.txt | 1 + typings/scipy/__init__.pyi | 55 ----------------- typings/scipy/fft/__init__.pyi | 72 ---------------------- typings/scipy/fft/_realtransforms.pyi | 88 --------------------------- typings/scipy/py.typed | 1 - 6 files changed, 1 insertion(+), 221 deletions(-) delete mode 100644 typings/scipy/__init__.pyi delete mode 100644 typings/scipy/fft/__init__.pyi delete mode 100644 typings/scipy/fft/_realtransforms.pyi delete mode 100644 typings/scipy/py.typed diff --git a/mypy.ini b/mypy.ini index 346c90b6..1a57757e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -22,8 +22,3 @@ exclude = .*(build)/.* ; Auto-generated code, not much we can do there [mypy-gen.*] disable_error_code = attr-defined, arg-type - -; Of course my stubs are going to be incomplete. Otherwise they'd be on typeshed! -; Mypy becomes really whack with its errors inside these stubs though -[mypy-scipy.*] -disable_error_code = attr-defined, import-untyped diff --git a/scripts/requirements-dev.txt b/scripts/requirements-dev.txt index 3f11be6e..b85fe3ec 100644 --- a/scripts/requirements-dev.txt +++ b/scripts/requirements-dev.txt @@ -15,6 +15,7 @@ ruff>=0.6.9 # Pre-commit fix # Must match .pre-commit-config.yaml # # Types +scipy-stubs>=1.14.1.1 types-keyboard types-psutil types-PyAutoGUI diff --git a/typings/scipy/__init__.pyi b/typings/scipy/__init__.pyi deleted file mode 100644 index 4b94936a..00000000 --- a/typings/scipy/__init__.pyi +++ /dev/null @@ -1,55 +0,0 @@ -from numpy.fft import ifft as ifft -from numpy.random import rand as rand, randn as randn -from scipy import ( - cluster, - constants, - datasets, - fft, - fftpack, - integrate, - interpolate, - io, - linalg, - misc, - ndimage, - odr, - optimize, - signal, - sparse, - spatial, - special, - stats, -) -from scipy.__config__ import show as show_config -from scipy._lib._ccallback import LowLevelCallable -from scipy._lib._testutils import PytestTester -from scipy.version import version as __version__ - -__all__ = [ - "LowLevelCallable", - "__version__", - "cluster", - "constants", - "datasets", - "fft", - "fftpack", - "integrate", - "interpolate", - "io", - "linalg", - "misc", - "ndimage", - "odr", - "optimize", - "show_config", - "signal", - "sparse", - "spatial", - "special", - "stats", - "test", -] - -test: PytestTester - -def __dir__() -> list[str]: ... diff --git a/typings/scipy/fft/__init__.pyi b/typings/scipy/fft/__init__.pyi deleted file mode 100644 index d27753fe..00000000 --- a/typings/scipy/fft/__init__.pyi +++ /dev/null @@ -1,72 +0,0 @@ -from numpy.fft import fftfreq, fftshift, ifftshift, rfftfreq -from scipy._lib._testutils import PytestTester -from scipy.fft._backend import register_backend, set_backend, set_global_backend, skip_backend -from scipy.fft._basic import ( - fft, - fft2, - fftn, - hfft, - hfft2, - hfftn, - ifft, - ifft2, - ifftn, - ihfft, - ihfft2, - ihfftn, - irfft, - irfft2, - irfftn, - rfft, - rfft2, - rfftn, -) -from scipy.fft._fftlog import fhtoffset -from scipy.fft._fftlog_multimethods import fht, ifht -from scipy.fft._helper import next_fast_len -from scipy.fft._pocketfft.helper import get_workers, set_workers -from scipy.fft._realtransforms import dct, dctn, dst, dstn, idct, idctn, idst, idstn - -__all__ = [ - "dct", - "dctn", - "dst", - "dstn", - "fft", - "fft2", - "fftfreq", - "fftn", - "fftshift", - "fht", - "fhtoffset", - "get_workers", - "hfft", - "hfft2", - "hfftn", - "idct", - "idctn", - "idst", - "idstn", - "ifft", - "ifft2", - "ifftn", - "ifftshift", - "ifht", - "ihfft", - "ihfft2", - "ihfftn", - "irfft", - "irfft2", - "irfftn", - "next_fast_len", - "register_backend", - "rfft", - "rfft2", - "rfftfreq", - "rfftn", - "set_backend", - "set_global_backend", - "set_workers", - "skip_backend", -] -test: PytestTester diff --git a/typings/scipy/fft/_realtransforms.pyi b/typings/scipy/fft/_realtransforms.pyi deleted file mode 100644 index 5d4a5c9e..00000000 --- a/typings/scipy/fft/_realtransforms.pyi +++ /dev/null @@ -1,88 +0,0 @@ -from typing import Literal - -from numpy import float64, generic -from numpy.typing import NDArray - -__all__ = ["dct", "dctn", "dst", "dstn", "idct", "idctn", "idst", "idstn"] - -def dctn( - x, - type=2, - s=None, - axes=None, - norm=None, - overwrite_x=False, - workers=None, - *, - orthogonalize=None, -): ... -def idctn( - x, - type=2, - s=None, - axes=None, - norm=None, - overwrite_x=False, - workers=None, - orthogonalize=None, -): ... -def dstn( - x, - type=2, - s=None, - axes=None, - norm=None, - overwrite_x=False, - workers=None, - orthogonalize=None, -): ... -def idstn( - x, - type=2, - s=None, - axes=None, - norm=None, - overwrite_x=False, - workers=None, - orthogonalize=None, -): ... -def dct( - x: NDArray[generic], - type: Literal[1, 2, 3, 4] = 2, - n: int | None = None, - axis: int = -1, - norm: Literal["backward", "ortho", "forward"] | None = None, - overwrite_x: bool = False, - workers: int | None = None, - orthogonalize: bool | None = None, -) -> NDArray[float64]: ... -def idct( - x, - type=2, - n=None, - axis=-1, - norm=None, - overwrite_x=False, - workers=None, - orthogonalize=None, -): ... -def dst( - x, - type=2, - n=None, - axis=-1, - norm=None, - overwrite_x=False, - workers=None, - orthogonalize=None, -): ... -def idst( - x, - type=2, - n=None, - axis=-1, - norm=None, - overwrite_x=False, - workers=None, - orthogonalize=None, -): ... diff --git a/typings/scipy/py.typed b/typings/scipy/py.typed deleted file mode 100644 index b648ac92..00000000 --- a/typings/scipy/py.typed +++ /dev/null @@ -1 +0,0 @@ -partial