Skip to content

Commit

Permalink
fix new basedpyright errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenham committed Nov 25, 2024
1 parent 1315148 commit b0dd40a
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 94 deletions.
14 changes: 7 additions & 7 deletions scipy-stubs/fft/_helper.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing import Any, Literal, TypeVar, overload
import numpy as np
import optype as op
import optype.numpy as onp
from numpy._typing import _ArrayLike, _NestedSequence
from numpy._typing import _ArrayLike
from scipy._typing import AnyShape

_SCT = TypeVar("_SCT", bound=np.inexact[Any])
Expand Down Expand Up @@ -41,21 +41,21 @@ def rfftfreq(n: int, d: float = 1.0, *, xp: ModuleType, device: object | None =
# TODO(jorenham): Array API support (for `x`)
# https://github.com/jorenham/scipy-stubs/issues/140
@overload
def fftshift(x: _ArrayLike[_SCT], axes: AnyShape | None = None) -> onp.ArrayND[_SCT]: ...
def fftshift(x: onp.ToIntND | onp.SequenceND[float], axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ...
@overload
def fftshift(x: onp.ToIntND | _NestedSequence[float], axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ...
def fftshift(x: onp.SequenceND[complex], axes: AnyShape | None = None) -> onp.ArrayND[np.complex128 | np.float64]: ...
@overload
def fftshift(x: _NestedSequence[complex], axes: AnyShape | None = None) -> onp.ArrayND[np.complex128 | np.float64]: ...
def fftshift(x: _ArrayLike[_SCT], axes: AnyShape | None = None) -> onp.ArrayND[_SCT]: ...
@overload
def fftshift(x: onp.ToComplexND, axes: AnyShape | None = None) -> onp.ArrayND[np.inexact[Any]]: ...

# TODO(jorenham): Array API support (for `x`)
# https://github.com/jorenham/scipy-stubs/issues/140
@overload
def ifftshift(x: _ArrayLike[_SCT], axes: AnyShape | None = None) -> onp.ArrayND[_SCT]: ...
def ifftshift(x: onp.ToIntND | onp.SequenceND[float], axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ...
@overload
def ifftshift(x: onp.ToIntND | _NestedSequence[float], axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ...
def ifftshift(x: onp.SequenceND[complex], axes: AnyShape | None = None) -> onp.ArrayND[np.complex128 | np.float64]: ...
@overload
def ifftshift(x: _NestedSequence[complex], axes: AnyShape | None = None) -> onp.ArrayND[np.complex128 | np.float64]: ...
def ifftshift(x: _ArrayLike[_SCT], axes: AnyShape | None = None) -> onp.ArrayND[_SCT]: ...
@overload
def ifftshift(x: onp.ToComplexND, axes: AnyShape | None = None) -> onp.ArrayND[np.inexact[Any]]: ...
8 changes: 3 additions & 5 deletions scipy-stubs/signal/_bsplines.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ __all__ = ["cspline1d", "cspline1d_eval", "gauss_spline", "qspline1d", "qspline1
_SCT_fc = TypeVar("_SCT_fc", bound=np.inexact[Any])

@overload
def gauss_spline(x: _ArrayLike[_SCT_fc], n: onp.ToInt) -> onp.ArrayND[_SCT_fc]: ...
@overload
def gauss_spline(x: onp.ToIntND, n: onp.ToInt) -> onp.ArrayND[np.float64]: ...
def gauss_spline(x: onp.ToIntND | onp.SequenceND[float], n: onp.ToInt) -> onp.ArrayND[np.float64]: ...
@overload
def gauss_spline(x: onp.ToFloatND, n: onp.ToInt) -> onp.ArrayND[np.floating[Any]]: ...
def gauss_spline(x: onp.SequenceND[complex], n: onp.ToInt) -> onp.ArrayND[np.complex128 | np.float64]: ...
@overload
def gauss_spline(x: onp.ToComplexND, n: onp.ToInt) -> onp.ArrayND[np.inexact[Any]]: ...
def gauss_spline(x: _ArrayLike[_SCT_fc], n: onp.ToInt) -> onp.ArrayND[_SCT_fc]: ...

#
def spline_filter(Iin: _ArrayLike[_SCT_fc], lmbda: onp.ToFloat = 5.0) -> onp.ArrayND[_SCT_fc]: ...
Expand Down
Loading

0 comments on commit b0dd40a

Please sign in to comment.