-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ruff 0.0.284 #54548
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
ruff 0.0.284 #54548
Conversation
return result | ||
# error: Incompatible return value type (got "MultiIndex", | ||
# expected "Self") | ||
return result # type: ignore[return-value] |
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'm not sure why mypy didn't find this previously: self == other
can return an ExtensionArray
and it seems that it doesn't define __invert__
) | ||
|
||
from pandas import DataFrame | ||
|
||
|
||
class ReaderBase(Protocol): | ||
class ReaderBase(ABC): |
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 this should be an abstract class and not a protocol.
@@ -211,6 +211,7 @@ line-length = 88 | |||
target-version = "py310" | |||
fix = true | |||
unfixable = [] | |||
typing-modules = ["pandas._typing"] |
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.
Needed for ruff to know that pandas._typing.Self
is the same as typing.Self
@@ -303,16 +304,14 @@ ignore = [ | |||
"PLW0603", | |||
# Docstrings should not be included in stubs | |||
"PYI021", | |||
# Use `typing.NamedTuple` instead of `collections.namedtuple` | |||
"PYI024", |
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 assume that there might be objections against enabling this rule as it might(?) affect runtime a tiny bit. Could move it to the todo list if there are no objections (currently in the ignore list).
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.
Would the runtime be present in the importing of NamedTuple? I would have thought that would be protected in if TYPE_CHECKING
?
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 believe it would have runtime implications (but they are likely to be neglectable) as you have to define a class that is used at runtime https://docs.python.org/3/library/typing.html#typing.NamedTuple
# Use typing_extensions.TypeAlias for type aliases | ||
# "PYI026", # not yet implemented | ||
# Use "collections.abc.*" instead of "typing.*" (PEP 585 syntax) | ||
# "PYI027", # not yet implemented |
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.
They are now implemented but they also did not require any changes.
Thanks @twoertwein |
* ruff 0.0.284 * fix strict type check * missing space
Ruff enabled many of the flake8-pyi rules for py files.