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

ENH: Add annotations for np.lib.function_base part 1 #20006

Merged
merged 5 commits into from
Oct 4, 2021

Conversation

BvB93
Copy link
Member

@BvB93 BvB93 commented Sep 30, 2021

This PR adds annotations for the np.lib.function_base module.

Considering the module is quite large, this will be the first of 2 or 3 PRs.

Comment on lines +1669 to +1677
@overload
def __getitem__(self, key: Union[
None,
slice,
ellipsis,
SupportsIndex,
_ArrayLikeInt_co,
Tuple[None | slice | ellipsis | _ArrayLikeInt_co | SupportsIndex, ...],
]) -> ndarray[Any, _DType_co]: ...
Copy link
Member Author

Choose a reason for hiding this comment

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

ndarray.__getitem__ annotations were required for the trim_zeros tests, so here we are.

`np.place` uses the `np.core.multiarray._insert` function under the hood, not to be confused with `np.insert` (which does accept slices)
@charris charris merged commit e7842a2 into numpy:main Oct 4, 2021
@charris
Copy link
Member

charris commented Oct 4, 2021

Thanks Bas.

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

4 participants