-
-
Notifications
You must be signed in to change notification settings - Fork 157
Type generic.pyi
#1562
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
base: main
Are you sure you want to change the base?
Type generic.pyi
#1562
Conversation
3009ab9 to
8717b4d
Compare
loicdiridollou
left a comment
There was a problem hiding this 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.
pandas-stubs/core/generic.pyi
Outdated
| def drop( | ||
| self, | ||
| labels=..., | ||
| labels: Hashable | Sequence[Hashable] | Index | None = None, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, thanks!
| 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: ... | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
cmp0xff
left a comment
There was a problem hiding this 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.
pandas-stubs/core/generic.pyi
Outdated
| def drop( | ||
| self, | ||
| labels=..., | ||
| labels: Hashable | ListLike | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| labels: Hashable | ListLike | None = None, | |
| labels: Hashable | ListLike = None, |
None ia also Hashable. Also applies to other cases in the changes.
assert_type()to assert the type of any return value)AGENTS.md.