Skip to content

Commit 55a57e3

Browse files
authored
Merge pull request #593 from numpy/gh-592
2 parents af1b33e + f49a9a1 commit 55a57e3

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/numpy-stubs/@test/static/accept/numeric.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ AR_O: _nt.Array[np.object_]
2222

2323
###
2424

25-
assert_type(np.count_nonzero(i8), int)
26-
assert_type(np.count_nonzero(AR_i8), int)
27-
assert_type(np.count_nonzero(ints), int)
25+
assert_type(np.count_nonzero(i8), np.intp)
26+
assert_type(np.count_nonzero(AR_i8), np.intp)
27+
assert_type(np.count_nonzero(ints), np.intp)
2828
assert_type(np.count_nonzero(AR_i8, keepdims=True), Any)
2929
assert_type(np.count_nonzero(AR_i8, axis=0), Any)
3030

src/numpy-stubs/_core/_multiarray_umath.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,9 @@ def interp_complex(
15051505
) -> np.complex128 | _nt.Array[np.complex128]: ...
15061506

15071507
#
1508-
def count_nonzero(a: object, /) -> int: ...
1508+
def count_nonzero(a: npt.ArrayLike, /) -> np.intp: ...
1509+
1510+
#
15091511
def bincount(
15101512
x: _nt.CoInteger_nd, /, weights: _nt.CoFloating_nd | None = None, minlength: CanIndex = 0
15111513
) -> _nt.Array[np.intp]: ...

src/numpy-stubs/_core/numeric.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from _typeshed import Incomplete
12
from builtins import bool as py_bool
23
from collections.abc import Callable, Sequence
34
from typing import (
@@ -2027,9 +2028,9 @@ def full_like(
20272028

20282029
#
20292030
@overload
2030-
def count_nonzero(a: ArrayLike, axis: None = None, *, keepdims: L[False] = False) -> int: ...
2031+
def count_nonzero(a: ArrayLike, axis: None = None, *, keepdims: L[False] = False) -> np.intp: ...
20312032
@overload
2032-
def count_nonzero(a: ArrayLike, axis: _ShapeLike | None = None, *, keepdims: py_bool = False) -> Any: ...
2033+
def count_nonzero(a: ArrayLike, axis: _ShapeLike | None = None, *, keepdims: py_bool = False) -> Incomplete: ...
20332034

20342035
#
20352036
def flatnonzero(a: ArrayLike) -> _nt.Array1D[np.intp]: ...

0 commit comments

Comments
 (0)