Skip to content

Commit 489be4d

Browse files
committed
upgrade pyflakes to 3.0.0
1 parent 8c06197 commit 489be4d

File tree

4 files changed

+6
-17
lines changed

4 files changed

+6
-17
lines changed

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ package_dir =
3636
install_requires =
3737
mccabe>=0.7.0,<0.8.0
3838
pycodestyle>=2.10.0,<2.11.0
39-
pyflakes>=2.5.0,<2.6.0
39+
pyflakes>=3.0.0,<3.1.0
4040
# 3.8.0's importlib.metadata is broken
4141
python_requires = >=3.8.1
4242

src/flake8/plugins/pyflakes.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import argparse
55
import ast
66
import os
7-
import tokenize
87
from typing import Any
98
from typing import Generator
109

@@ -52,13 +51,13 @@
5251
"DefaultExceptNotLast": "F707",
5352
"DoctestSyntaxError": "F721",
5453
"ForwardAnnotationSyntaxError": "F722",
55-
"CommentAnnotationSyntaxError": "F723",
5654
"RedefinedWhileUnused": "F811",
5755
"UndefinedName": "F821",
5856
"UndefinedExport": "F822",
5957
"UndefinedLocal": "F823",
6058
"DuplicateArgument": "F831",
6159
"UnusedVariable": "F841",
60+
"UnusedAnnotation": "F842",
6261
"RaiseNotImplemented": "F901",
6362
}
6463

@@ -70,12 +69,7 @@ class FlakesChecker(pyflakes.checker.Checker):
7069
include_in_doctest: list[str] = []
7170
exclude_from_doctest: list[str] = []
7271

73-
def __init__(
74-
self,
75-
tree: ast.AST,
76-
file_tokens: list[tokenize.TokenInfo],
77-
filename: str,
78-
) -> None:
72+
def __init__(self, tree: ast.AST, filename: str) -> None:
7973
"""Initialize the PyFlakes plugin with an AST tree and filename."""
8074
filename = utils.normalize_path(filename)
8175
with_doctest = self.with_doctest
@@ -99,12 +93,7 @@ def __init__(
9993
if overlapped_by:
10094
with_doctest = True
10195

102-
super().__init__(
103-
tree,
104-
filename=filename,
105-
withDoctest=with_doctest,
106-
file_tokens=file_tokens,
107-
)
96+
super().__init__(tree, filename=filename, withDoctest=with_doctest)
10897

10998
@classmethod
11099
def add_options(cls, parser: OptionManager) -> None:

tests/unit/plugins/finder_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def test_load_plugin_ok():
685685
assert loaded == finder.LoadedPlugin(
686686
plugin,
687687
FlakesChecker,
688-
{"tree": True, "file_tokens": True, "filename": True},
688+
{"tree": True, "filename": True},
689689
)
690690

691691

tests/unit/test_pyflakes_codes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def f():
2727
sys = sys
2828
"""
2929
tree = ast.parse(src)
30-
checker = pyflakes_shim.FlakesChecker(tree, [], "t.py")
30+
checker = pyflakes_shim.FlakesChecker(tree, "t.py")
3131
message_texts = [s for _, _, s, _ in checker.run()]
3232
assert message_texts == [
3333
"F823 local variable 'sys' defined in enclosing scope on line 1 referenced before assignment", # noqa: E501

0 commit comments

Comments
 (0)