Skip to content

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

Merged
merged 4 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/pyflakes/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "~=3.3.2"
version = "3.4.*"
upstream_repository = "https://github.com/PyCQA/pyflakes"
7 changes: 7 additions & 0 deletions stubs/pyflakes/pyflakes/checker.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,13 @@ else:

if sys.version_info >= (3, 14):
_NameConstant: TypeAlias = Never
_TemplateStr: TypeAlias = ast.TemplateStr
_Interpolation: TypeAlias = ast.Interpolation
else:
_NameConstant: TypeAlias = ast.NameConstant
# The methods using these should never be called on Python < 3.14.
_TemplateStr: TypeAlias = Never
_Interpolation: TypeAlias = Never

class Checker:
nodeDepth: int
Expand Down Expand Up @@ -308,6 +313,8 @@ class Checker:
def KEYWORD(self, tree: ast.keyword, omit: _OmitType = None) -> None: ...
def FORMATTEDVALUE(self, tree: ast.FormattedValue, omit: _OmitType = None) -> None: ...
def JOINEDSTR(self, node: ast.AST) -> None: ...
def TEMPLATESTR(self, node: _TemplateStr) -> None: ...
def INTERPOLATION(self, tree: _Interpolation, omit: _OmitType = None) -> None: ...
Comment on lines +316 to +317
Copy link
Collaborator

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?

Suggested change
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.

Copy link
Contributor Author

@donBarbos donBarbos Jun 30, 2025

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)

def DICT(self, node: ast.Dict) -> None: ...
def IF(self, node: ast.If) -> None: ...
def IFEXP(self, node: ast.If) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions stubs/pyflakes/pyflakes/messages.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class RaiseNotImplemented(Message): ...
class InvalidPrintSyntax(Message): ...
class IsLiteral(Message): ...
class FStringMissingPlaceholders(Message): ...
class TStringMissingPlaceholders(Message): ...

class StringDotFormatExtraPositionalArguments(Message):
message_args: tuple[str]
Expand Down