Skip to content

Conversation

@MarcoGorelli
Copy link
Member

No description provided.

Copy link
Member

@jorenham jorenham left a comment

Choose a reason for hiding this comment

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

This looks good. I left some suggestions that could make this even better.

@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 10, 2025 16:45
@jorenham
Copy link
Member

there are some merge conflicts

Comment on lines 681 to 688
@overload
def take(
self,
indices: _IntLike_co,
axis: SupportsIndex | None = None,
out: None = None,
mode: _ModeKind = 'raise',
) -> Any: ...
Copy link
Member

Choose a reason for hiding this comment

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

The overload above always gets matched, so unless I'm missing something, this one can be removed.

Suggested change
@overload
def take(
self,
indices: _IntLike_co,
axis: SupportsIndex | None = None,
out: None = None,
mode: _ModeKind = 'raise',
) -> Any: ...

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, thanks! I was under the impression that some masked arrays could be of dtypes that might not be possible to match against MaskedArray[_SCT], but I should have asked

have removed 👍

Comment on lines 697 to 704
@overload
def take(
self,
indices: _ArrayLikeInt_co,
axis: SupportsIndex | None = None,
out: None = None,
mode: _ModeKind = 'raise',
) -> _MaskedArray[Any]: ...
Copy link
Member

Choose a reason for hiding this comment

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

Same story here

Suggested change
@overload
def take(
self,
indices: _ArrayLikeInt_co,
axis: SupportsIndex | None = None,
out: None = None,
mode: _ModeKind = 'raise',
) -> _MaskedArray[Any]: ...

@jorenham jorenham merged commit 2bfef66 into numpy:main Apr 11, 2025
56 of 63 checks passed
@jorenham
Copy link
Member

Thanks, Marco

MaanasArora pushed a commit to MaanasArora/numpy that referenced this pull request Apr 11, 2025
* TYP: Type ``MaskedArray.take`` and ``np.ma.take``

* broaden `a` type

* it gets broader

* 🎨

* remove redundant overloads

* reduce diff
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.

2 participants