Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3e44f97

Browse filesBrowse files
committed
Refine count_nonzero typing stub
1 parent bc2b042 commit 3e44f97
Copy full SHA for 3e44f97

File tree

Expand file treeCollapse file tree

2 files changed

+4
-11
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-11
lines changed

‎numpy/_core/numeric.pyi

Copy file name to clipboardExpand all lines: numpy/_core/numeric.pyi
+1-8Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,7 @@ def full_like(
428428
@overload
429429
def count_nonzero(
430430
a: ArrayLike,
431-
axis: None = ...,
432-
*,
433-
keepdims: L[False] = ...,
434-
) -> int: ...
435-
@overload
436-
def count_nonzero(
437-
a: ArrayLike,
438-
axis: _ShapeLike = ...,
431+
axis: None | _ShapeLike = ...,
439432
*,
440433
keepdims: bool = ...,
441434
) -> Any: ... # TODO: np.intp or ndarray[np.intp]

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

Copy file name to clipboardExpand all lines: numpy/typing/tests/data/reveal/numeric.pyi
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ AR_O: npt.NDArray[np.object_]
2727
B: list[int]
2828
C: SubClass
2929

30-
assert_type(np.count_nonzero(i8), int)
31-
assert_type(np.count_nonzero(AR_i8), int)
32-
assert_type(np.count_nonzero(B), int)
30+
assert_type(np.count_nonzero(i8), Any)
31+
assert_type(np.count_nonzero(AR_i8), Any)
32+
assert_type(np.count_nonzero(B), Any)
3333
assert_type(np.count_nonzero(AR_i8, keepdims=True), Any)
3434
assert_type(np.count_nonzero(AR_i8, axis=0), Any)
3535

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.