Skip to content

Commit 498c897

Browse files
committed
♻️ refactor _Call11Bool dtype parameter to use _DTypeLikeBool
1 parent 900bb44 commit 498c897

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/numpy-stubs/_typing/_ufunc.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ from typing_extensions import Never, TypeAliasType, TypeVar, Unpack
1414

1515
import numpy as np
1616
from numpy import _CastingKind, _OrderKACF # noqa: ICN003
17-
from numpy._typing import _NestedSequence
17+
from numpy._typing import _DTypeLikeBool, _NestedSequence
1818

1919
from ._array_like import ArrayLike, NDArray, _ArrayLikeBool_co, _ArrayLikeInt_co
2020
from ._dtype_like import DTypeLike, _DTypeLike
@@ -187,7 +187,7 @@ class _Call11Bool(Protocol):
187187
/,
188188
out: None = None,
189189
*,
190-
dtype: DTypeLike | None = None,
190+
dtype: _DTypeLikeBool | None = None,
191191
**kwds: Unpack[_Kwargs2],
192192
) -> np.bool: ...
193193
@overload # (array-like, out: T) -> T
@@ -197,7 +197,7 @@ class _Call11Bool(Protocol):
197197
/,
198198
out: _Out1[_ArrayT],
199199
*,
200-
dtype: DTypeLike | None = None,
200+
dtype: _DTypeLikeBool | None = None,
201201
**kwds: Unpack[_Kwargs2],
202202
) -> _ArrayT: ...
203203
@overload # (array) -> Array[bool] | bool
@@ -207,7 +207,7 @@ class _Call11Bool(Protocol):
207207
/,
208208
out: _Out1[_AnyArray] | None = None,
209209
*,
210-
dtype: DTypeLike | None = None,
210+
dtype: _DTypeLikeBool | None = None,
211211
**kwds: Unpack[_Kwargs2],
212212
) -> NDArray[np.bool]: ...
213213
@overload # (array-like) -> Array[bool] | bool
@@ -217,7 +217,7 @@ class _Call11Bool(Protocol):
217217
/,
218218
out: _Out1[_AnyArray] | None = None,
219219
*,
220-
dtype: DTypeLike | None = None,
220+
dtype: _DTypeLikeBool | None = None,
221221
**kwds: Unpack[_Kwargs2],
222222
) -> NDArray[np.bool] | np.bool: ...
223223

test/static/reject/ufuncs.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
import numpy.typing as npt
33

4+
i8: np.int64
45
AR_f8: npt.NDArray[np.float64]
56

67
np.sin.nin + "foo" # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
@@ -40,3 +41,8 @@ np.matmul.accumulate() # type: ignore[call-arg] # pyright: ignore[reportCallIs
4041
np.frexp.at() # type: ignore[call-arg, misc] # pyright: ignore[reportCallIssue]
4142
np.divmod.at() # type: ignore[call-arg, misc] # pyright: ignore[reportCallIssue]
4243
np.matmul.at() # type: ignore[call-arg, misc] # pyright: ignore[reportCallIssue]
44+
45+
np.isnan(i8, dtype=int) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
46+
np.isnat(i8, dtype=np.int64) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
47+
np.isinf(i8, dtype=np.int64) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]
48+
np.isfinite(i8, dtype=np.int64) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue]

0 commit comments

Comments
 (0)