flake8 7.1.2__tar.gz → 7.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {flake8-7.1.2/src/flake8.egg-info → flake8-7.2.0}/PKG-INFO +4 -4
  2. {flake8-7.1.2 → flake8-7.2.0}/setup.cfg +3 -3
  3. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/__init__.py +1 -1
  4. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/checker.py +4 -6
  5. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/discover_files.py +4 -4
  6. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/main/application.py +1 -1
  7. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/main/cli.py +1 -1
  8. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/options/aggregator.py +1 -1
  9. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/options/manager.py +1 -1
  10. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/options/parse_args.py +1 -1
  11. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/plugins/finder.py +6 -6
  12. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/plugins/pycodestyle.py +3 -3
  13. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/plugins/pyflakes.py +3 -2
  14. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/processor.py +6 -10
  15. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/statistics.py +2 -2
  16. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/style_guide.py +6 -12
  17. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/utils.py +2 -2
  18. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/violation.py +1 -1
  19. {flake8-7.1.2 → flake8-7.2.0/src/flake8.egg-info}/PKG-INFO +4 -4
  20. flake8-7.2.0/src/flake8.egg-info/requires.txt +3 -0
  21. flake8-7.1.2/src/flake8.egg-info/requires.txt +0 -3
  22. {flake8-7.1.2 → flake8-7.2.0}/LICENSE +0 -0
  23. {flake8-7.1.2 → flake8-7.2.0}/README.rst +0 -0
  24. {flake8-7.1.2 → flake8-7.2.0}/setup.py +0 -0
  25. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/__main__.py +0 -0
  26. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/_compat.py +0 -0
  27. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/api/__init__.py +0 -0
  28. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/api/legacy.py +0 -0
  29. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/defaults.py +0 -0
  30. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/exceptions.py +0 -0
  31. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/formatting/__init__.py +0 -0
  32. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/formatting/_windows_color.py +0 -0
  33. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/formatting/base.py +0 -0
  34. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/formatting/default.py +0 -0
  35. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/main/__init__.py +0 -0
  36. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/main/debug.py +0 -0
  37. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/main/options.py +0 -0
  38. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/options/__init__.py +0 -0
  39. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/options/config.py +0 -0
  40. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/plugins/__init__.py +0 -0
  41. {flake8-7.1.2 → flake8-7.2.0}/src/flake8/plugins/reporter.py +0 -0
  42. {flake8-7.1.2 → flake8-7.2.0}/src/flake8.egg-info/SOURCES.txt +0 -0
  43. {flake8-7.1.2 → flake8-7.2.0}/src/flake8.egg-info/dependency_links.txt +0 -0
  44. {flake8-7.1.2 → flake8-7.2.0}/src/flake8.egg-info/entry_points.txt +0 -0
  45. {flake8-7.1.2 → flake8-7.2.0}/src/flake8.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flake8
3
- Version: 7.1.2
3
+ Version: 7.2.0
4
4
  Summary: the modular source code checker: pep8 pyflakes and co
5
5
  Home-page: https://github.com/pycqa/flake8
6
6
  Author: Tarek Ziade
@@ -20,12 +20,12 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
20
20
  Classifier: Programming Language :: Python :: Implementation :: PyPy
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
22
  Classifier: Topic :: Software Development :: Quality Assurance
23
- Requires-Python: >=3.8.1
23
+ Requires-Python: >=3.9
24
24
  Description-Content-Type: text/x-rst
25
25
  License-File: LICENSE
26
26
  Requires-Dist: mccabe<0.8.0,>=0.7.0
27
- Requires-Dist: pycodestyle<2.13.0,>=2.12.0
28
- Requires-Dist: pyflakes<3.3.0,>=3.2.0
27
+ Requires-Dist: pycodestyle<2.14.0,>=2.13.0
28
+ Requires-Dist: pyflakes<3.4.0,>=3.3.0
29
29
 
30
30
  .. image:: https://github.com/PyCQA/flake8/workflows/main/badge.svg
31
31
  :target: https://github.com/PyCQA/flake8/actions?query=workflow%3Amain
@@ -29,9 +29,9 @@ classifiers =
29
29
  packages = find:
30
30
  install_requires =
31
31
  mccabe>=0.7.0,<0.8.0
32
- pycodestyle>=2.12.0,<2.13.0
33
- pyflakes>=3.2.0,<3.3.0
34
- python_requires = >=3.8.1
32
+ pycodestyle>=2.13.0,<2.14.0
33
+ pyflakes>=3.3.0,<3.4.0
34
+ python_requires = >=3.9
35
35
  package_dir =
36
36
  =src
37
37
 
@@ -17,7 +17,7 @@ import sys
17
17
  LOG = logging.getLogger(__name__)
18
18
  LOG.addHandler(logging.NullHandler())
19
19
 
20
- __version__ = "7.1.2"
20
+ __version__ = "7.2.0"
21
21
  __version_info__ = tuple(int(i) for i in __version__.split(".") if i.isdigit())
22
22
 
23
23
  _VERBOSITY_TO_LOG_LEVEL = {
@@ -9,12 +9,10 @@ import multiprocessing.pool
9
9
  import operator
10
10
  import signal
11
11
  import tokenize
12
+ from collections.abc import Generator
13
+ from collections.abc import Sequence
12
14
  from typing import Any
13
- from typing import Generator
14
- from typing import List
15
15
  from typing import Optional
16
- from typing import Sequence
17
- from typing import Tuple
18
16
 
19
17
  from flake8 import defaults
20
18
  from flake8 import exceptions
@@ -27,7 +25,7 @@ from flake8.plugins.finder import Checkers
27
25
  from flake8.plugins.finder import LoadedPlugin
28
26
  from flake8.style_guide import StyleGuideManager
29
27
 
30
- Results = List[Tuple[str, int, int, str, Optional[str]]]
28
+ Results = list[tuple[str, int, int, str, Optional[str]]]
31
29
 
32
30
  LOG = logging.getLogger(__name__)
33
31
 
@@ -53,7 +51,7 @@ _mp_options: argparse.Namespace
53
51
  @contextlib.contextmanager
54
52
  def _mp_prefork(
55
53
  plugins: Checkers, options: argparse.Namespace
56
- ) -> Generator[None, None, None]:
54
+ ) -> Generator[None]:
57
55
  # we can save significant startup work w/ `fork` multiprocessing
58
56
  global _mp_plugins, _mp_options
59
57
  _mp_plugins, _mp_options = plugins, options
@@ -3,9 +3,9 @@ from __future__ import annotations
3
3
 
4
4
  import logging
5
5
  import os.path
6
+ from collections.abc import Generator
7
+ from collections.abc import Sequence
6
8
  from typing import Callable
7
- from typing import Generator
8
- from typing import Sequence
9
9
 
10
10
  from flake8 import utils
11
11
 
@@ -16,7 +16,7 @@ def _filenames_from(
16
16
  arg: str,
17
17
  *,
18
18
  predicate: Callable[[str], bool],
19
- ) -> Generator[str, None, None]:
19
+ ) -> Generator[str]:
20
20
  """Generate filenames from an argument.
21
21
 
22
22
  :param arg:
@@ -55,7 +55,7 @@ def expand_paths(
55
55
  stdin_display_name: str,
56
56
  filename_patterns: Sequence[str],
57
57
  exclude: Sequence[str],
58
- ) -> Generator[str, None, None]:
58
+ ) -> Generator[str]:
59
59
  """Expand out ``paths`` from commandline to the lintable files."""
60
60
  if not paths:
61
61
  paths = ["."]
@@ -5,7 +5,7 @@ import argparse
5
5
  import json
6
6
  import logging
7
7
  import time
8
- from typing import Sequence
8
+ from collections.abc import Sequence
9
9
 
10
10
  import flake8
11
11
  from flake8 import checker
@@ -2,7 +2,7 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import sys
5
- from typing import Sequence
5
+ from collections.abc import Sequence
6
6
 
7
7
  from flake8.main import application
8
8
 
@@ -8,7 +8,7 @@ from __future__ import annotations
8
8
  import argparse
9
9
  import configparser
10
10
  import logging
11
- from typing import Sequence
11
+ from collections.abc import Sequence
12
12
 
13
13
  from flake8.options import config
14
14
  from flake8.options.manager import OptionManager
@@ -5,9 +5,9 @@ import argparse
5
5
  import enum
6
6
  import functools
7
7
  import logging
8
+ from collections.abc import Sequence
8
9
  from typing import Any
9
10
  from typing import Callable
10
- from typing import Sequence
11
11
 
12
12
  from flake8 import utils
13
13
  from flake8.plugins.finder import Plugins
@@ -2,7 +2,7 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import argparse
5
- from typing import Sequence
5
+ from collections.abc import Sequence
6
6
 
7
7
  import flake8
8
8
  from flake8.main import options
@@ -7,9 +7,9 @@ import inspect
7
7
  import itertools
8
8
  import logging
9
9
  import sys
10
+ from collections.abc import Generator
11
+ from collections.abc import Iterable
10
12
  from typing import Any
11
- from typing import Generator
12
- from typing import Iterable
13
13
  from typing import NamedTuple
14
14
 
15
15
  from flake8 import utils
@@ -68,7 +68,7 @@ class Plugins(NamedTuple):
68
68
  reporters: dict[str, LoadedPlugin]
69
69
  disabled: list[LoadedPlugin]
70
70
 
71
- def all_plugins(self) -> Generator[LoadedPlugin, None, None]:
71
+ def all_plugins(self) -> Generator[LoadedPlugin]:
72
72
  """Return an iterator over all :class:`LoadedPlugin`s."""
73
73
  yield from self.checkers.tree
74
74
  yield from self.checkers.logical_line
@@ -151,7 +151,7 @@ def _flake8_plugins(
151
151
  eps: Iterable[importlib.metadata.EntryPoint],
152
152
  name: str,
153
153
  version: str,
154
- ) -> Generator[Plugin, None, None]:
154
+ ) -> Generator[Plugin]:
155
155
  pyflakes_meta = importlib.metadata.distribution("pyflakes").metadata
156
156
  pycodestyle_meta = importlib.metadata.distribution("pycodestyle").metadata
157
157
 
@@ -173,7 +173,7 @@ def _flake8_plugins(
173
173
  yield Plugin(name, version, ep)
174
174
 
175
175
 
176
- def _find_importlib_plugins() -> Generator[Plugin, None, None]:
176
+ def _find_importlib_plugins() -> Generator[Plugin]:
177
177
  # some misconfigured pythons (RHEL) have things on `sys.path` twice
178
178
  seen = set()
179
179
  for dist in importlib.metadata.distributions():
@@ -212,7 +212,7 @@ def _find_importlib_plugins() -> Generator[Plugin, None, None]:
212
212
 
213
213
  def _find_local_plugins(
214
214
  cfg: configparser.RawConfigParser,
215
- ) -> Generator[Plugin, None, None]:
215
+ ) -> Generator[Plugin]:
216
216
  for plugin_type in ("extension", "report"):
217
217
  group = f"flake8.{plugin_type}"
218
218
  for plugin_s in utils.parse_comma_separated_list(
@@ -2,8 +2,8 @@
2
2
  # fmt: off
3
3
  from __future__ import annotations
4
4
 
5
+ from collections.abc import Generator
5
6
  from typing import Any
6
- from typing import Generator
7
7
 
8
8
  from pycodestyle import ambiguous_identifier as _ambiguous_identifier
9
9
  from pycodestyle import bare_except as _bare_except
@@ -55,7 +55,7 @@ def pycodestyle_logical(
55
55
  previous_unindented_logical_line: Any,
56
56
  tokens: Any,
57
57
  verbose: Any,
58
- ) -> Generator[tuple[int, str], None, None]:
58
+ ) -> Generator[tuple[int, str]]:
59
59
  """Run pycodestyle logical checks."""
60
60
  yield from _ambiguous_identifier(logical_line, tokens)
61
61
  yield from _bare_except(logical_line, noqa)
@@ -93,7 +93,7 @@ def pycodestyle_physical(
93
93
  noqa: Any,
94
94
  physical_line: Any,
95
95
  total_lines: Any,
96
- ) -> Generator[tuple[int, str], None, None]:
96
+ ) -> Generator[tuple[int, str]]:
97
97
  """Run pycodestyle physical checks."""
98
98
  ret = _maximum_line_length(physical_line, max_line_length, multiline, line_number, noqa) # noqa: E501
99
99
  if ret is not None:
@@ -4,8 +4,8 @@ from __future__ import annotations
4
4
  import argparse
5
5
  import ast
6
6
  import logging
7
+ from collections.abc import Generator
7
8
  from typing import Any
8
- from typing import Generator
9
9
 
10
10
  import pyflakes.checker
11
11
 
@@ -55,6 +55,7 @@ FLAKE8_PYFLAKES_CODES = {
55
55
  "UndefinedName": "F821",
56
56
  "UndefinedExport": "F822",
57
57
  "UndefinedLocal": "F823",
58
+ "UnusedIndirectAssignment": "F824",
58
59
  "DuplicateArgument": "F831",
59
60
  "UnusedVariable": "F841",
60
61
  "UnusedAnnotation": "F842",
@@ -97,7 +98,7 @@ class FlakesChecker(pyflakes.checker.Checker):
97
98
  cls.builtIns = cls.builtIns.union(options.builtins)
98
99
  cls.with_doctest = options.doctests
99
100
 
100
- def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]:
101
+ def run(self) -> Generator[tuple[int, int, str, type[Any]]]:
101
102
  """Run the plugin."""
102
103
  for message in self.messages:
103
104
  col = getattr(message, "col", 0)
@@ -6,10 +6,8 @@ import ast
6
6
  import functools
7
7
  import logging
8
8
  import tokenize
9
+ from collections.abc import Generator
9
10
  from typing import Any
10
- from typing import Generator
11
- from typing import List
12
- from typing import Tuple
13
11
 
14
12
  from flake8 import defaults
15
13
  from flake8 import utils
@@ -24,8 +22,8 @@ SKIP_TOKENS = frozenset(
24
22
  [tokenize.NL, tokenize.NEWLINE, tokenize.INDENT, tokenize.DEDENT]
25
23
  )
26
24
 
27
- _LogicalMapping = List[Tuple[int, Tuple[int, int]]]
28
- _Logical = Tuple[List[str], List[str], _LogicalMapping]
25
+ _LogicalMapping = list[tuple[int, tuple[int, int]]]
26
+ _Logical = tuple[list[str], list[str], _LogicalMapping]
29
27
 
30
28
 
31
29
  class FileProcessor:
@@ -127,9 +125,7 @@ class FileProcessor:
127
125
  """Signal the beginning of an fstring."""
128
126
  self._fstring_start = lineno
129
127
 
130
- def multiline_string(
131
- self, token: tokenize.TokenInfo
132
- ) -> Generator[str, None, None]:
128
+ def multiline_string(self, token: tokenize.TokenInfo) -> Generator[str]:
133
129
  """Iterate through the lines of a multiline string."""
134
130
  if token.type == FSTRING_END: # pragma: >=3.12 cover
135
131
  start = self._fstring_start
@@ -210,7 +206,7 @@ class FileProcessor:
210
206
  brace_offset = text.count("{") + text.count("}")
211
207
  text = "x" * (len(text) + brace_offset)
212
208
  end = (end[0], end[1] + brace_offset)
213
- if previous_row:
209
+ if previous_row is not None and previous_column is not None:
214
210
  (start_row, start_column) = start
215
211
  if previous_row != start_row:
216
212
  row_index = previous_row - 1
@@ -263,7 +259,7 @@ class FileProcessor:
263
259
  )
264
260
  return ret
265
261
 
266
- def generate_tokens(self) -> Generator[tokenize.TokenInfo, None, None]:
262
+ def generate_tokens(self) -> Generator[tokenize.TokenInfo]:
267
263
  """Tokenize the file and yield the tokens."""
268
264
  for token in tokenize.generate_tokens(self.next_line):
269
265
  if token[2][0] > self.total_lines:
@@ -1,7 +1,7 @@
1
1
  """Statistic collection logic for Flake8."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Generator
4
+ from collections.abc import Generator
5
5
  from typing import NamedTuple
6
6
 
7
7
  from flake8.violation import Violation
@@ -36,7 +36,7 @@ class Statistics:
36
36
 
37
37
  def statistics_for(
38
38
  self, prefix: str, filename: str | None = None
39
- ) -> Generator[Statistic, None, None]:
39
+ ) -> Generator[Statistic]:
40
40
  """Generate statistics for the prefix and filename.
41
41
 
42
42
  If you have a :class:`Statistics` object that has recorded errors,
@@ -7,8 +7,8 @@ import copy
7
7
  import enum
8
8
  import functools
9
9
  import logging
10
- from typing import Generator
11
- from typing import Sequence
10
+ from collections.abc import Generator
11
+ from collections.abc import Sequence
12
12
 
13
13
  from flake8 import defaults
14
14
  from flake8 import statistics
@@ -225,13 +225,11 @@ class StyleGuideManager:
225
225
  *self.populate_style_guides_with(options),
226
226
  ]
227
227
 
228
- self.style_guide_for = functools.lru_cache(maxsize=None)(
229
- self._style_guide_for
230
- )
228
+ self.style_guide_for = functools.cache(self._style_guide_for)
231
229
 
232
230
  def populate_style_guides_with(
233
231
  self, options: argparse.Namespace
234
- ) -> Generator[StyleGuide, None, None]:
232
+ ) -> Generator[StyleGuide]:
235
233
  """Generate style guides from the per-file-ignores option.
236
234
 
237
235
  :param options:
@@ -253,9 +251,7 @@ class StyleGuideManager:
253
251
  )
254
252
 
255
253
  @contextlib.contextmanager
256
- def processing_file(
257
- self, filename: str
258
- ) -> Generator[StyleGuide, None, None]:
254
+ def processing_file(self, filename: str) -> Generator[StyleGuide]:
259
255
  """Record the fact that we're processing the file's results."""
260
256
  guide = self.style_guide_for(filename)
261
257
  with guide.processing_file(filename):
@@ -338,9 +334,7 @@ class StyleGuide:
338
334
  )
339
335
 
340
336
  @contextlib.contextmanager
341
- def processing_file(
342
- self, filename: str
343
- ) -> Generator[StyleGuide, None, None]:
337
+ def processing_file(self, filename: str) -> Generator[StyleGuide]:
344
338
  """Record the fact that we're processing the file's results."""
345
339
  self.formatter.beginning(filename)
346
340
  yield self
@@ -11,9 +11,9 @@ import re
11
11
  import sys
12
12
  import textwrap
13
13
  import tokenize
14
+ from collections.abc import Sequence
15
+ from re import Pattern
14
16
  from typing import NamedTuple
15
- from typing import Pattern
16
- from typing import Sequence
17
17
 
18
18
  from flake8 import exceptions
19
19
 
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
  import functools
5
5
  import linecache
6
6
  import logging
7
- from typing import Match
7
+ from re import Match
8
8
  from typing import NamedTuple
9
9
 
10
10
  from flake8 import defaults
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flake8
3
- Version: 7.1.2
3
+ Version: 7.2.0
4
4
  Summary: the modular source code checker: pep8 pyflakes and co
5
5
  Home-page: https://github.com/pycqa/flake8
6
6
  Author: Tarek Ziade
@@ -20,12 +20,12 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
20
20
  Classifier: Programming Language :: Python :: Implementation :: PyPy
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
22
  Classifier: Topic :: Software Development :: Quality Assurance
23
- Requires-Python: >=3.8.1
23
+ Requires-Python: >=3.9
24
24
  Description-Content-Type: text/x-rst
25
25
  License-File: LICENSE
26
26
  Requires-Dist: mccabe<0.8.0,>=0.7.0
27
- Requires-Dist: pycodestyle<2.13.0,>=2.12.0
28
- Requires-Dist: pyflakes<3.3.0,>=3.2.0
27
+ Requires-Dist: pycodestyle<2.14.0,>=2.13.0
28
+ Requires-Dist: pyflakes<3.4.0,>=3.3.0
29
29
 
30
30
  .. image:: https://github.com/PyCQA/flake8/workflows/main/badge.svg
31
31
  :target: https://github.com/PyCQA/flake8/actions?query=workflow%3Amain
@@ -0,0 +1,3 @@
1
+ mccabe<0.8.0,>=0.7.0
2
+ pycodestyle<2.14.0,>=2.13.0
3
+ pyflakes<3.4.0,>=3.3.0
@@ -1,3 +0,0 @@
1
- mccabe<0.8.0,>=0.7.0
2
- pycodestyle<2.13.0,>=2.12.0
3
- pyflakes<3.3.0,>=3.2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes