Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Update the annotations in np.core.numeric #17564

Merged
merged 4 commits into from Oct 21, 2020
Merged

Conversation

BvB93
Copy link
Member

@BvB93 BvB93 commented Oct 14, 2020

This PR updates the annotations in np.core.numeric and adds a number of tests (which were previously absent).

Generally speaking the updates fall in one of the following categories:

  • Annotation-aliases (e.g. _CorrelateMode = Literal[...]) were moved to the top of the module.
  • The addition of previously missing overloads.
  • The replacement of certain annotations with either DtypeLike or _Shapelike (when appropriate).
  • The addition of missing arguments (see fromfunction and count_nonzero).

Bas van Beek added 3 commits October 14, 2020 16:57
* Added missing overloads
* Use `DtypeLike` and `_Shapelike` where applicable
* Moved a few annotation-aliases to the top of the module
@overload
def count_nonzero(
a: ArrayLike, axis: None = ..., *, keepdims: Literal[False] = ...
) -> int: ...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit odd that one overload returns a builtin int and the other one a numpy signedinteger (or an array).
See #17562.

) -> ndarray: ...
def rollaxis(a: ArrayLike, axis: int, start: int = ...) -> ndarray: ...
def rollaxis(a: ndarray, axis: int, start: int = ...) -> ndarray: ...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the docs: rollaxis takes an array, not an array-like object.

`axes` can take either an integer or a 2-tuple of shape-like objects
@mattip mattip merged commit 854f95a into numpy:master Oct 21, 2020
@mattip
Copy link
Member

mattip commented Oct 21, 2020

Thanks @BvB93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants