-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
STY: Bump pyright, pyupgrade and mypy for new PEP-696 syntax #60006
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
Conversation
@@ -369,7 +369,7 @@ def _coerce_to_array( | |||
assert dtype == "boolean" | |||
return coerce_to_array(value, copy=copy) | |||
|
|||
def _logical_method(self, other, op): | |||
def _logical_method(self, other, op): # type: ignore[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.
I've never seen a type-ignore on the signature of a function, do you know why this is needed?
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.
Here's the mypy error
pandas/core/arrays/boolean.py:372: error: Signature of "_logical_method" incompatible with supertype "BaseMaskedArray" [override]
pandas/core/arrays/boolean.py:372: note: Superclass:
pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
pandas/core/arrays/boolean.py:372: note: Subclass:
pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
pandas/core/arrays/boolean.py:372: note: Superclass:
pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
pandas/core/arrays/boolean.py:372: note: Subclass:
pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
In BasedMaskedArray we assign _logical_method = _arith_method
, but override _logical_method
in BooleanArray. It looks mypy is doing some inference on self
even though we don't type 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.
I think self
is typed implicitly, yes. Makes sense that it's an override issue, thanks.
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.
lgtm
Also bumps flake8 and pre-commit which should have innocuous changes