-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
TYP: Add overload for ser.rename_axis #55412
Conversation
pre-commit.ci autofix |
338a2ad
to
697b4e8
Compare
697b4e8
to
482c006
Compare
pre-commit.ci autofix |
3de1e1c
to
540d5e2
Compare
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.
black complains, otherwise, it looks good to me!
pre-commit.ci autofix |
pandas/core/series.py
Outdated
@@ -5004,6 +5004,42 @@ def reindex( # type: ignore[override] | |||
tolerance=tolerance, | |||
) | |||
|
|||
@overload |
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.
It seems that the error codes are misaligned, see mypy:
pandas/core/series.py:5007: error: Signature of "rename_axis" incompatible with supertype "NDFrame" [override]
[...]
pandas/core/series.py:5008: error: Unused "type: ignore" comment [unused-ignore]
pandas/core/series.py:5020: error: Unused "type: ignore" comment [unused-ignore]
pandas/core/series.py:5032: error: Unused "type: ignore" comment [unused-ignore]
pandas/core/series.py:5044: error: Unused "type: ignore" comment [unused-ignore]
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.
Fixed I think
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.
you might want to run mypy (and black) locally :)
pandas/core/series.py:5007: error: Signature of "rename_axis" incompatible with supertype "NDFrame" [override]
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.
Sorry, went and got my precommit setup fixed now and will run locally.
What is the actual issue? Without the ignore it complains about incompatible signatures, and adding the ignore it just says the ignore is unused. So what is the right fix? I see they are incompatible because ser.rename_axis takes less arguments but I don't know what to do about it
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.
Mpyps seems to expect the ignore only on specific lines (5007), not all of them.
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.
OK understood. Now it seems to be not complaining.
0655a12
to
ffbc32d
Compare
for more information, see https://pre-commit.ci
ffbc32d
to
a608be6
Compare
Thank you @caneff ! |
Another overload that improves typing when not using stubs.