-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bump pyflakes to 3.4.* #14316
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
Bump pyflakes to 3.4.* #14316
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Nice, LGTM :-)
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
def TEMPLATESTR(self, node: _TemplateStr) -> None: ... | ||
def INTERPOLATION(self, tree: _Interpolation, omit: _OmitType = 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.
Instead of type aliases, would it be better to put the if
statements directly here, like this?
def TEMPLATESTR(self, node: _TemplateStr) -> None: ... | |
def INTERPOLATION(self, tree: _Interpolation, omit: _OmitType = None) -> None: ... | |
if sys.version_info >= (3, 14): | |
def TEMPLATESTR(self, node: ast.TemplateStr) -> None: ... | |
def INTERPOLATION(self, tree: ast.Interpolation, omit: _OmitType = None) -> None: ... | |
else: | |
# The methods using these should never be called on Python < 3.14. | |
def TEMPLATESTR(self, node: Never) -> None: ... | |
def INTERPOLATION(self, tree: Never, omit: _OmitType = None) -> None: ... |
This way IDE users will see ast.TemplateStr
instead of _TemplateStr
in hover tooltips and such. Type checker error messages will also be better.
The downside is that overriding the method is more difficult, but to me it seems like it's not meant to be overwritten.
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 idea, but the practice of using type aliases has developed before
we can suggest doing this in a separate PR/issue for the entire file (I think this would be more correct)
Closes: #14314