Skip to content

Commit 1ceb3dc

Browse files
committed
Refine count_nonzero typing stub
1 parent 5a6edb6 commit 1ceb3dc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

numpy/_core/numeric.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def full_like(
416416

417417
#
418418
@overload
419-
def count_nonzero(a: ArrayLike, axis: None = None, *, keepdims: L[False] = False) -> int: ...
419+
def count_nonzero(a: ArrayLike, axis: None = None, *, keepdims: L[False] = False) -> np.intp: ...
420420
@overload
421421
def count_nonzero(a: _ScalarLike_co, axis: _ShapeLike | None = None, *, keepdims: L[True]) -> np.intp: ...
422422
@overload

numpy/typing/tests/data/reveal/numeric.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ AR_O: npt.NDArray[np.object_]
2525
B: list[int]
2626
C: SubClass
2727

28-
assert_type(np.count_nonzero(i8), int)
29-
assert_type(np.count_nonzero(AR_i8), int)
30-
assert_type(np.count_nonzero(B), int)
28+
assert_type(np.count_nonzero(i8), np.intp)
29+
assert_type(np.count_nonzero(AR_i8), np.intp)
30+
assert_type(np.count_nonzero(B), np.intp)
3131
assert_type(np.count_nonzero(AR_i8, keepdims=True), npt.NDArray[np.intp])
3232
assert_type(np.count_nonzero(AR_i8, axis=0), Any)
3333

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy