|
| 1 | +from _typeshed import Incomplete |
1 | 2 | from types import ModuleType
|
2 |
| -from typing import Any, Literal, TypeVar, overload |
| 3 | +from typing import Literal, TypeVar, overload |
3 | 4 |
|
4 | 5 | import numpy as np
|
5 | 6 | import optype as op
|
6 | 7 | import optype.numpy as onp
|
7 |
| -from numpy._typing import _ArrayLike |
| 8 | +import optype.numpy.compat as npc |
8 | 9 |
|
9 | 10 | from scipy._typing import AnyShape
|
10 | 11 |
|
11 |
| -_SCT = TypeVar("_SCT", bound=np.inexact[Any]) |
| 12 | +_InexactT = TypeVar("_InexactT", bound=npc.inexact) |
12 | 13 |
|
13 | 14 | def next_fast_len(target: op.CanIndex, real: op.CanBool = False) -> int: ...
|
14 | 15 | def prev_fast_len(target: op.CanIndex, real: op.CanBool = False) -> int: ...
|
15 | 16 |
|
16 | 17 | #
|
17 | 18 | @overload # xp: None -> np.fft.fftfreq
|
18 | 19 | def fftfreq(
|
19 |
| - n: int | np.integer[Any], d: onp.ToFloat = 1.0, *, xp: None = None, device: Literal["cpu"] | None = None |
| 20 | + n: int | npc.integer, d: onp.ToFloat = 1.0, *, xp: None = None, device: Literal["cpu"] | None = None |
20 | 21 | ) -> onp.Array1D[np.float64]: ...
|
21 | 22 | @overload # xp: ModuleType -> xp.fft.fftfreq
|
22 |
| -def fftfreq(n: int, d: float = 1.0, *, xp: ModuleType, device: object | None = None) -> Any: ... |
| 23 | +def fftfreq(n: int, d: float = 1.0, *, xp: ModuleType, device: object | None = None) -> Incomplete: ... |
23 | 24 |
|
24 | 25 | #
|
25 | 26 | @overload # np.fft.rfftfreq
|
26 | 27 | def rfftfreq(
|
27 |
| - n: int | np.integer[Any], d: onp.ToFloat = 1.0, *, xp: None = None, device: Literal["cpu"] | None = None |
| 28 | + n: int | npc.integer, d: onp.ToFloat = 1.0, *, xp: None = None, device: Literal["cpu"] | None = None |
28 | 29 | ) -> onp.Array1D[np.float64]: ...
|
29 |
| -@overload # xp.fft.fftfreq |
30 |
| -def rfftfreq(n: int, d: float = 1.0, *, xp: ModuleType, device: object | None = None) -> Any: ... |
| 30 | +@overload |
| 31 | +def rfftfreq(n: int, d: float = 1.0, *, xp: ModuleType, device: object | None = None) -> Incomplete: ... |
31 | 32 |
|
32 | 33 | #
|
33 | 34 | @overload
|
34 |
| -def fftshift(x: onp.ToIntND | onp.SequenceND[float], axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ... |
| 35 | +def fftshift(x: onp.ToIntND | onp.ToJustFloat64_ND, axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ... |
35 | 36 | @overload
|
36 |
| -def fftshift(x: onp.SequenceND[complex], axes: AnyShape | None = None) -> onp.ArrayND[np.complex128 | np.float64]: ... |
| 37 | +def fftshift(x: onp.ToJustComplex128_ND, axes: AnyShape | None = None) -> onp.ArrayND[np.complex128]: ... |
37 | 38 | @overload
|
38 |
| -def fftshift(x: _ArrayLike[_SCT], axes: AnyShape | None = None) -> onp.ArrayND[_SCT]: ... |
| 39 | +def fftshift(x: onp.ToArrayND[_InexactT, _InexactT], axes: AnyShape | None = None) -> onp.ArrayND[_InexactT]: ... |
39 | 40 | @overload
|
40 |
| -def fftshift(x: onp.ToComplexND, axes: AnyShape | None = None) -> onp.ArrayND[np.inexact[Any]]: ... |
| 41 | +def fftshift(x: onp.ToComplexND, axes: AnyShape | None = None) -> onp.ArrayND[npc.inexact]: ... |
41 | 42 |
|
42 | 43 | #
|
43 | 44 | @overload
|
44 |
| -def ifftshift(x: onp.ToIntND | onp.SequenceND[float], axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ... |
| 45 | +def ifftshift(x: onp.ToIntND | onp.ToJustFloat64_ND, axes: AnyShape | None = None) -> onp.ArrayND[np.float64]: ... |
45 | 46 | @overload
|
46 |
| -def ifftshift(x: onp.SequenceND[complex], axes: AnyShape | None = None) -> onp.ArrayND[np.complex128 | np.float64]: ... |
| 47 | +def ifftshift(x: onp.ToJustComplex128_ND, axes: AnyShape | None = None) -> onp.ArrayND[np.complex128]: ... |
47 | 48 | @overload
|
48 |
| -def ifftshift(x: _ArrayLike[_SCT], axes: AnyShape | None = None) -> onp.ArrayND[_SCT]: ... |
| 49 | +def ifftshift(x: onp.ToArrayND[_InexactT, _InexactT], axes: AnyShape | None = None) -> onp.ArrayND[_InexactT]: ... |
49 | 50 | @overload
|
50 |
| -def ifftshift(x: onp.ToComplexND, axes: AnyShape | None = None) -> onp.ArrayND[np.inexact[Any]]: ... |
| 51 | +def ifftshift(x: onp.ToComplexND, axes: AnyShape | None = None) -> onp.ArrayND[npc.inexact]: ... |
0 commit comments