Skip to content

Conversation

@MarcoGorelli
Copy link
Member

  • Closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added (Please use assert_type() to assert the type of any return value)
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md.

@MarcoGorelli MarcoGorelli marked this pull request as ready for review December 17, 2025 13:08
@MarcoGorelli MarcoGorelli changed the title Typ generic Type generic.pyi Dec 17, 2025
Copy link
Member

@loicdiridollou loicdiridollou left a comment

Choose a reason for hiding this comment

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

One minor thing but then should be good.

def drop(
self,
labels=...,
labels: Hashable | Sequence[Hashable] | Index | None = None,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should be able to put range here too, docs says single label or iterable of labels so range should fit, maybe ListLike would be a slightly wider type.

Copy link
Member Author

Choose a reason for hiding this comment

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

good call, thanks!

Comment on lines 565 to 573
if sys.version_info >= (3, 11):
def __array__(
self, dtype: _str | np.dtype = ..., copy: bool | None = ...
) -> np_1darray: ...
else:
def __array__(
self, dtype: _str | np.dtype[Any] = ..., copy: bool | None = ...
) -> np_1darray: ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep it, it is needed for the pyright strict transition.

Copy link
Member Author

Choose a reason for hiding this comment

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

is it ok to handle this within NpDType?

Copy link
Contributor

@cmp0xff cmp0xff Dec 17, 2025

Choose a reason for hiding this comment

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

NpDtype is different from str | np.dtype. It will take a separate PR to handle, I think.

Copy link
Contributor

@cmp0xff cmp0xff left a comment

Choose a reason for hiding this comment

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

I will leave the PR to @loicdiridollou since he has alread started reviewing. I just wanted to point out the np.dtype issue.

def drop(
self,
labels=...,
labels: Hashable | ListLike | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
labels: Hashable | ListLike | None = None,
labels: Hashable | ListLike = None,

None ia also Hashable. Also applies to other cases in the changes.

@cmp0xff cmp0xff self-requested a review December 17, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants