This repository was archived by the owner on Jun 10, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 32
WiP: Added type annotations for the np.core.fromnumeric
module
#59
Closed
Closed
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2a1c59c
Implemented Warning and Exception annotations
ba767a0
Annotate using Python 2 compatible type comments
ac0ce25
Addressed comments from https://github.com/numpy/numpy-stubs/pull/57
f672123
Merge remote-tracking branch 'upstream/master'
80e3976
Added np.all() and np.any()
7404d1a
Implemented type annotations for the np.core.fromnumeric module
8e4ce4e
Added typing_extensions as a requirement for python < 3.8
7ae41fc
Renamed the any_all.py to fromnumeric.py
6f802db
Run black one more time
ea31239
Added new overloads; wrapped up the reveal tests
b7c1af5
Merge branch 'master' into master
BvB93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import numpy as np | ||
|
||
A = np.array([True]) | ||
A.setflags(write=False) | ||
|
||
reveal_type(np.all(A)) # E: numpy.bool_ | ||
reveal_type(np.all(A, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.all(A, keepdims=False)) # E: numpy.bool_ | ||
reveal_type(np.all(A, axis=0, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.all(A, axis=0, keepdims=False)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.all(A, keepdims=True, axis=0)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.all(A, keepdims=False, axis=0)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.all(A, axis=0)) # E: Union[numpy.bool_, numpy.ndarray] | ||
|
||
reveal_type(np.any(A)) # E: numpy.bool_ | ||
reveal_type(np.any(A, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.any(A, keepdims=False)) # E: numpy.bool_ | ||
reveal_type(np.any(A, axis=0, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.any(A, axis=0, keepdims=False)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.any(A, keepdims=True, axis=0)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.any(A, keepdims=False, axis=0)) # E: Union[numpy.bool_, numpy.ndarray] | ||
reveal_type(np.any(A, axis=0)) # E: Union[numpy.bool_, numpy.ndarray] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.