Skip to content

Commit 607330f

Browse files
authored
🔧 .mypyignore cleanup (#392)
2 parents 7508dcb + e21d510 commit 607330f

File tree

15 files changed

+285
-268
lines changed

15 files changed

+285
-268
lines changed

‎.mypyignore

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,30 @@ scipy\.stats\._rcont\.rcont
2020
# why is this even included in the wheels?
2121
scipy\.special\._precompute\..*
2222

23-
# omitted methods that always return `NotImplemented` or always raise
24-
# scipy\.sparse\._(\w+)\._(\w+)\.__(len|i(add|mul|sub)|(i|r)(true)?div)__
25-
2623
# workarounds for mypy bugs
27-
scipy\.signal\._short_time_fft\.(FFT_MODE_TYPE|PAD_TYPE) # `Literal[...] != def (*, **)`
28-
scipy\.(_lib|integrate|stats)\.((_|\w)+\.)+__replace__ # `NamedTuple` on `python >= 3.13`
29-
30-
# stubtest doesn't understand `if sys.version_info >= _: ...` blocks
31-
scipy\.sparse\.(\w+)\.warn
24+
scipy\.(_lib|integrate|stats)\.((_|\w)+\.)+__replace__ # `NamedTuple` on `python>=3.13`
25+
scipy\.sparse\.(\w+)\.warn # all `if sys.version_info` branches are checked...?
3226

3327
# annoying and useless __new__
3428
scipy\.stats\.(_new_distributions\.)?Normal\.__new__
3529

3630
# mypy fails recognize type-check-only ufunc subtypes as ufuncs
31+
# https://github.com/KotlinIsland/basedmypy/issues/815
3732
# https://github.com/KotlinIsland/basedmypy/issues/816
38-
scipy\.special\._basic\.digamma
39-
scipy\.special\._support_alternative_backends\..*
4033
scipy\.stats\._qmvnt\.phi(nv)?
41-
42-
# https://github.com/KotlinIsland/basedmypy/issues/815
43-
scipy\.special\._ufuncs\._(hypergeom|nbinom|nc(f|t))_(mean|variance|skewness|kurtosis_excess)
34+
scipy\.special\._basic\.digamma
35+
scipy\.special\._support_alternative_backends\.betaincc?
36+
scipy\.special\._support_alternative_backends\.gamma(incc?|ln)
37+
scipy\.special\._support_alternative_backends\.(rel_)?entr
38+
scipy\.special\._support_alternative_backends\.erfc?
39+
scipy\.special\._support_alternative_backends\.(exp|log)it
40+
scipy\.special\._support_alternative_backends\.i(0|1)e?
41+
scipy\.special\._support_alternative_backends\.xlogy
42+
scipy\.special\._support_alternative_backends\.chdtrc?
43+
scipy\.special\._support_alternative_backends\.(log_)?ndtri?
44+
scipy\.special\._support_alternative_backends\.stdtr
4445
scipy\.special\._ufuncs\._(hypergeom|n?binom)_(pm|cd|pp|i?s)f
46+
scipy\.special\._ufuncs\._(hypergeom|nbinom|nc(f|t))_(mean|variance|skewness|kurtosis_excess)
4547
scipy\.special\._ufuncs\._(beta|cauchy|invgauss|landau|nc(f|t|x2)|skewnorm)_(pd|cd|pp|i?s)f
4648
scipy\.special\._ufuncs\._cosine_(inv)?cdf
4749
scipy\.special\._ufuncs\._(cos|sin)pi

‎scipy-stubs/signal/_short_time_fft.pyi

Lines changed: 116 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ from .windows._windows import _ToWindow
88

99
__all__ = ["ShortTimeFFT"]
1010

11+
###
12+
1113
_InexactND: TypeAlias = onp.ArrayND[np.inexact[Any]]
1214

15+
_PadType: TypeAlias = Literal["zeros", "edge", "even", "odd"]
16+
_FFTModeType: TypeAlias = Literal["twosided", "centered", "onesided", "onesided2X"]
1317
_ScaleTo: TypeAlias = Literal["magnitude", "psd"]
1418
_Detr: TypeAlias = (
1519
Literal["linear", "constant"]
@@ -19,77 +23,100 @@ _Detr: TypeAlias = (
1923

2024
###
2125

22-
# awkward naming, but this matches the "attempts at type-aliases" in the implementation
23-
PAD_TYPE: TypeAlias = Literal["zeros", "edge", "even", "odd"]
24-
FFT_MODE_TYPE: TypeAlias = Literal["twosided", "centered", "onesided", "onesided2X"]
25-
2626
class ShortTimeFFT:
27-
def __init__(
28-
self,
29-
/,
30-
win: _InexactND,
31-
hop: int,
32-
fs: float,
33-
*,
34-
fft_mode: FFT_MODE_TYPE = "onesided",
35-
mfft: int | None = None,
36-
dual_win: _InexactND | None = None,
37-
scale_to: _ScaleTo | None = None,
38-
phase_shift: int | None = 0,
39-
) -> None: ...
40-
@classmethod
41-
def from_dual(
42-
cls,
43-
dual_win: _InexactND,
44-
hop: int,
45-
fs: float,
46-
*,
47-
fft_mode: FFT_MODE_TYPE = "onesided",
48-
mfft: int | None = None,
49-
scale_to: _ScaleTo | None = None,
50-
phase_shift: int | None = 0,
51-
) -> Self: ...
52-
@classmethod
53-
def from_window(
54-
cls,
55-
win_param: _ToWindow,
56-
fs: float,
57-
nperseg: int,
58-
noverlap: int,
59-
*,
60-
symmetric_win: bool = False,
61-
fft_mode: FFT_MODE_TYPE = "onesided",
62-
mfft: int | None = None,
63-
scale_to: _ScaleTo | None = None,
64-
phase_shift: int | None = 0,
65-
) -> Self: ...
6627
@property
6728
def win(self, /) -> _InexactND: ...
6829
@property
30+
def dual_win(self, /) -> _InexactND: ...
31+
@property
6932
def hop(self, /) -> int: ...
7033
@property
34+
def invertible(self, /) -> bool: ...
35+
@property
36+
def fac_magnitude(self, /) -> float: ...
37+
@property
38+
def fac_psd(self, /) -> float: ...
39+
@property
40+
def m_num(self, /) -> int: ...
41+
@property
42+
def m_num_mid(self, /) -> int: ...
43+
@property
44+
def k_min(self, /) -> int: ...
45+
@property
46+
def p_min(self, /) -> int: ...
47+
@property
48+
def lower_border_end(self, /) -> tuple[int, int]: ...
49+
@property
50+
def delta_t(self, /) -> float: ...
51+
@property
52+
def delta_f(self, /) -> float: ...
53+
@property
54+
def f_pts(self, /) -> int: ...
55+
@property
56+
def f(self, /) -> _InexactND: ...
57+
@property
58+
def onesided_fft(self, /) -> bool: ...
59+
60+
#
61+
@property
7162
def T(self, /) -> float: ...
7263
@T.setter
7364
def T(self, /, v: float) -> None: ...
65+
66+
#
7467
@property
7568
def fs(self, /) -> float: ...
7669
@fs.setter
7770
def fs(self, /, v: float) -> None: ...
71+
72+
#
7873
@property
79-
def fft_mode(self, /) -> FFT_MODE_TYPE: ...
74+
def fft_mode(self, /) -> _FFTModeType: ...
8075
@fft_mode.setter
81-
def fft_mode(self, /, t: FFT_MODE_TYPE) -> None: ...
76+
def fft_mode(self, /, t: _FFTModeType) -> None: ...
77+
78+
#
8279
@property
8380
def mfft(self, /) -> int: ...
8481
@mfft.setter
8582
def mfft(self, /, n_: int) -> None: ...
86-
@property
87-
def scaling(self, /) -> _ScaleTo | None: ...
88-
def scale_to(self, /, scaling: _ScaleTo) -> None: ...
83+
84+
#
8985
@property
9086
def phase_shift(self, /) -> int | None: ...
9187
@phase_shift.setter
9288
def phase_shift(self, /, v: int | None) -> None: ...
89+
90+
#
91+
@property
92+
def scaling(self, /) -> _ScaleTo | None: ...
93+
94+
#
95+
def __init__(
96+
self,
97+
/,
98+
win: _InexactND,
99+
hop: int,
100+
fs: float,
101+
*,
102+
fft_mode: _FFTModeType = "onesided",
103+
mfft: int | None = None,
104+
dual_win: _InexactND | None = None,
105+
scale_to: _ScaleTo | None = None,
106+
phase_shift: int | None = 0,
107+
) -> None: ...
108+
109+
#
110+
def k_max(self, /, n: int) -> int: ...
111+
def p_max(self, /, n: int) -> int: ...
112+
def p_num(self, /, n: int) -> int: ...
113+
def nearest_k_p(self, /, k: int, left: bool = True) -> int: ...
114+
def upper_border_begin(self, /, n: int) -> tuple[int, int]: ...
115+
def p_range(self, /, n: int, p0: int | None = None, p1: int | None = None) -> tuple[int, int]: ...
116+
def t(self, /, n: int, p0: int | None = None, p1: int | None = None, k_offset: int = 0) -> _InexactND: ...
117+
def scale_to(self, /, scaling: _ScaleTo) -> None: ...
118+
119+
#
93120
def stft(
94121
self,
95122
/,
@@ -98,9 +125,19 @@ class ShortTimeFFT:
98125
p1: int | None = None,
99126
*,
100127
k_offset: int = 0,
101-
padding: PAD_TYPE = "zeros",
128+
padding: _PadType = "zeros",
102129
axis: int = -1,
103130
) -> _InexactND: ...
131+
def istft(
132+
self,
133+
/,
134+
S: _InexactND,
135+
k0: int = 0,
136+
k1: int | None = None,
137+
*,
138+
f_axis: int = -2,
139+
t_axis: int = -1,
140+
) -> _InexactND: ...
104141
def stft_detrend(
105142
self,
106143
/,
@@ -110,7 +147,7 @@ class ShortTimeFFT:
110147
p1: int | None = None,
111148
*,
112149
k_offset: int = 0,
113-
padding: PAD_TYPE = "zeros",
150+
padding: _PadType = "zeros",
114151
axis: int = -1,
115152
) -> _InexactND: ...
116153
def spectrogram(
@@ -123,58 +160,41 @@ class ShortTimeFFT:
123160
p0: int | None = None,
124161
p1: int | None = None,
125162
k_offset: int = 0,
126-
padding: PAD_TYPE = "zeros",
163+
padding: _PadType = "zeros",
127164
axis: int = -1,
128165
) -> _InexactND: ...
129-
@property
130-
def dual_win(self, /) -> _InexactND: ...
131-
@property
132-
def invertible(self, /) -> bool: ...
133-
def istft(
134-
self,
135-
/,
136-
S: _InexactND,
137-
k0: int = 0,
138-
k1: int | None = None,
139-
*,
140-
f_axis: int = -2,
141-
t_axis: int = -1,
142-
) -> _InexactND: ...
143-
@property
144-
def fac_magnitude(self, /) -> float: ...
145-
@property
146-
def fac_psd(self, /) -> float: ...
147-
@property
148-
def m_num(self, /) -> int: ...
149-
@property
150-
def m_num_mid(self, /) -> int: ...
151-
@property
152-
def k_min(self, /) -> int: ...
153-
@property
154-
def p_min(self, /) -> int: ...
155-
def k_max(self, /, n: int) -> int: ...
156-
def p_max(self, /, n: int) -> int: ...
157-
def p_num(self, /, n: int) -> int: ...
158-
@property
159-
def lower_border_end(self, /) -> tuple[int, int]: ...
160-
def upper_border_begin(self, /, n: int) -> tuple[int, int]: ...
161-
@property
162-
def delta_t(self, /) -> float: ...
163-
def p_range(self, /, n: int, p0: int | None = None, p1: int | None = None) -> tuple[int, int]: ...
164-
def t(self, /, n: int, p0: int | None = None, p1: int | None = None, k_offset: int = 0) -> _InexactND: ...
165-
def nearest_k_p(self, /, k: int, left: bool = True) -> int: ...
166-
@property
167-
def delta_f(self, /) -> float: ...
168-
@property
169-
def f_pts(self, /) -> int: ...
170-
@property
171-
def onesided_fft(self, /) -> bool: ...
172-
@property
173-
def f(self, /) -> _InexactND: ...
174166
def extent(
175167
self,
176168
/,
177169
n: int,
178170
axes_seq: Literal["tf", "ft"] = "tf",
179171
center_bins: bool = False,
180172
) -> tuple[float, float, float, float]: ...
173+
174+
#
175+
@classmethod
176+
def from_dual(
177+
cls,
178+
dual_win: _InexactND,
179+
hop: int,
180+
fs: float,
181+
*,
182+
fft_mode: _FFTModeType = "onesided",
183+
mfft: int | None = None,
184+
scale_to: _ScaleTo | None = None,
185+
phase_shift: int | None = 0,
186+
) -> Self: ...
187+
@classmethod
188+
def from_window(
189+
cls,
190+
win_param: _ToWindow,
191+
fs: float,
192+
nperseg: int,
193+
noverlap: int,
194+
*,
195+
symmetric_win: bool = False,
196+
fft_mode: _FFTModeType = "onesided",
197+
mfft: int | None = None,
198+
scale_to: _ScaleTo | None = None,
199+
phase_shift: int | None = 0,
200+
) -> Self: ...

‎scipy-stubs/sparse/base.pyi

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# ruff: noqa: ANN401
12
# This module is not meant for public use and will be removed in SciPy v2.0.0.
2-
from typing import Final
3+
4+
from typing import Any, Final
35
from typing_extensions import deprecated
46

57
from . import _base, _matrix
@@ -21,7 +23,7 @@ __all__ = [
2123
"validateaxis",
2224
]
2325

24-
MAXPRINT: Final[int]
26+
MAXPRINT: Final[int] = ...
2527

2628
@deprecated("will be removed in SciPy v2.0.0")
2729
class SparseWarning(_base.SparseWarning): ...
@@ -36,22 +38,22 @@ class SparseEfficiencyWarning(_base.SparseEfficiencyWarning): ...
3638
class spmatrix(_matrix.spmatrix): ...
3739

3840
@deprecated("will be removed in SciPy v2.0.0")
39-
def issparse(x: object) -> object: ...
41+
def issparse(x: object) -> bool: ...
4042
@deprecated("will be removed in SciPy v2.0.0")
41-
def isspmatrix(x: object) -> object: ...
43+
def isspmatrix(x: object) -> bool: ...
4244

4345
# sputils
4446
@deprecated("will be removed in SciPy v2.0.0")
45-
def check_shape(args: object, current_shape: object = ..., *, allow_nd: object = ...) -> object: ...
47+
def check_shape(args: object, current_shape: object = ..., *, allow_nd: object = ...) -> Any: ...
4648
@deprecated("will be removed in SciPy v2.0.0")
47-
def check_reshape_kwargs(kwargs: object) -> object: ...
49+
def check_reshape_kwargs(kwargs: object) -> Any: ...
4850
@deprecated("will be removed in SciPy v2.0.0")
4951
def validateaxis(axis: object) -> None: ...
5052
@deprecated("will be removed in SciPy v2.0.0")
51-
def isdense(x: object) -> object: ...
53+
def isdense(x: object) -> Any: ...
5254
@deprecated("will be removed in SciPy v2.0.0")
53-
def isscalarlike(x: object) -> object: ...
55+
def isscalarlike(x: object) -> Any: ...
5456
@deprecated("will be removed in SciPy v2.0.0")
55-
def get_sum_dtype(dtype: object) -> object: ...
57+
def get_sum_dtype(dtype: object) -> Any: ...
5658
@deprecated("will be removed in SciPy v2.0.0")
57-
def asmatrix(data: object, dtype: object = ...) -> object: ...
59+
def asmatrix(data: object, dtype: object = ...) -> Any: ...

0 commit comments

Comments
 (0)