Skip to content

Commit 6029268

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 084402d commit 6029268

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+86
-30
lines changed

bin/gen-pycodestyle-plugin

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Call(NamedTuple):
4242
return cls(func.__name__, inspect.isgeneratorfunction(func), params)
4343

4444

45-
def lines() -> Generator[str, None, None]:
45+
def lines() -> Generator[str]:
4646
logical = []
4747
physical = []
4848

example-plugin/src/flake8_example_plugin/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for an example Flake8 plugin."""
2+
23
from __future__ import annotations
34

45
from .off_by_default import ExampleTwo

example-plugin/src/flake8_example_plugin/off_by_default.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Our first example plugin."""
2+
23
from __future__ import annotations
34

45

example-plugin/src/flake8_example_plugin/on_by_default.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Our first example plugin."""
2+
23
from __future__ import annotations
34

45

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ install_requires =
3131
mccabe>=0.7.0,<0.8.0
3232
pycodestyle>=2.12.0,<2.13.0
3333
pyflakes>=3.2.0,<3.3.0
34-
python_requires = >=3.8.1
34+
python_requires = >=3.9
3535
package_dir =
3636
=src
3737

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Packaging logic for Flake8."""
2+
23
from __future__ import annotations
34

45
import os

src/flake8/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
.. autofunction:: flake8.configure_logging
1010
1111
"""
12+
1213
from __future__ import annotations
1314

1415
import logging

src/flake8/__main__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module allowing for ``python -m flake8 ...``."""
2+
23
from __future__ import annotations
34

45
from flake8.main.cli import main

src/flake8/api/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
This is the only submodule in Flake8 with a guaranteed stable API. All other
44
submodules are considered internal only and are subject to change.
55
"""
6+
67
from __future__ import annotations

src/flake8/api/legacy.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Previously, users would import :func:`get_style_guide` from ``flake8.engine``.
44
In 3.0 we no longer have an "engine" module but we maintain the API from it.
55
"""
6+
67
from __future__ import annotations
78

89
import argparse

src/flake8/checker.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Checker Manager and Checker classes."""
2+
23
from __future__ import annotations
34

45
import argparse
@@ -53,7 +54,7 @@
5354
@contextlib.contextmanager
5455
def _mp_prefork(
5556
plugins: Checkers, options: argparse.Namespace
56-
) -> Generator[None, None, None]:
57+
) -> Generator[None]:
5758
# we can save significant startup work w/ `fork` multiprocessing
5859
global _mp_plugins, _mp_options
5960
_mp_plugins, _mp_options = plugins, options

src/flake8/defaults.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Constants that define defaults."""
2+
23
from __future__ import annotations
34

45
import re

src/flake8/discover_files.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Functions related to discovering paths."""
2+
23
from __future__ import annotations
34

45
import logging
@@ -16,7 +17,7 @@ def _filenames_from(
1617
arg: str,
1718
*,
1819
predicate: Callable[[str], bool],
19-
) -> Generator[str, None, None]:
20+
) -> Generator[str]:
2021
"""Generate filenames from an argument.
2122
2223
:param arg:
@@ -55,7 +56,7 @@ def expand_paths(
5556
stdin_display_name: str,
5657
filename_patterns: Sequence[str],
5758
exclude: Sequence[str],
58-
) -> Generator[str, None, None]:
59+
) -> Generator[str]:
5960
"""Expand out ``paths`` from commandline to the lintable files."""
6061
if not paths:
6162
paths = ["."]

src/flake8/exceptions.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Exception classes for all of Flake8."""
2+
23
from __future__ import annotations
34

45

src/flake8/formatting/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Submodule containing the default formatters for Flake8."""
2+
23
from __future__ import annotations

src/flake8/formatting/_windows_color.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
See: https://github.com/pre-commit/pre-commit/blob/cb40e96/pre_commit/color.py
44
"""
5+
56
from __future__ import annotations
67

78
import sys

src/flake8/formatting/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The base class and interface for all formatting plugins."""
2+
23
from __future__ import annotations
34

45
import argparse

src/flake8/formatting/default.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Default formatting class for Flake8."""
2+
23
from __future__ import annotations
34

45
from flake8.formatting import base

src/flake8/main/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Module containing the logic for the Flake8 entry-points."""
2+
23
from __future__ import annotations

src/flake8/main/application.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module containing the application logic for Flake8."""
2+
23
from __future__ import annotations
34

45
import argparse

src/flake8/main/cli.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Command-line implementation of flake8."""
2+
23
from __future__ import annotations
34

45
import sys

src/flake8/main/debug.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module containing the logic for our debugging logic."""
2+
23
from __future__ import annotations
34

45
import platform

src/flake8/main/options.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Contains the logic for all of the default options for Flake8."""
2+
23
from __future__ import annotations
34

45
import argparse

src/flake8/options/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
to aggregate configuration into one object used by plugins and Flake8.
1111
1212
"""
13+
1314
from __future__ import annotations

src/flake8/options/aggregator.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This holds the logic that uses the collected and merged config files and
44
applies the user-specified command-line configuration on top of it.
55
"""
6+
67
from __future__ import annotations
78

89
import argparse

src/flake8/options/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Config handling logic for Flake8."""
2+
23
from __future__ import annotations
34

45
import configparser

src/flake8/options/manager.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Option handling and Option management logic."""
2+
23
from __future__ import annotations
34

45
import argparse

src/flake8/options/parse_args.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Procedure for parsing args, config, loading plugins."""
2+
23
from __future__ import annotations
34

45
import argparse

src/flake8/plugins/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Submodule of built-in plugins and plugin managers."""
2+
23
from __future__ import annotations

src/flake8/plugins/finder.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Functions related to finding and loading plugins."""
2+
23
from __future__ import annotations
34

45
import configparser
@@ -68,7 +69,7 @@ class Plugins(NamedTuple):
6869
reporters: dict[str, LoadedPlugin]
6970
disabled: list[LoadedPlugin]
7071

71-
def all_plugins(self) -> Generator[LoadedPlugin, None, None]:
72+
def all_plugins(self) -> Generator[LoadedPlugin]:
7273
"""Return an iterator over all :class:`LoadedPlugin`s."""
7374
yield from self.checkers.tree
7475
yield from self.checkers.logical_line
@@ -151,7 +152,7 @@ def _flake8_plugins(
151152
eps: Iterable[importlib.metadata.EntryPoint],
152153
name: str,
153154
version: str,
154-
) -> Generator[Plugin, None, None]:
155+
) -> Generator[Plugin]:
155156
pyflakes_meta = importlib.metadata.distribution("pyflakes").metadata
156157
pycodestyle_meta = importlib.metadata.distribution("pycodestyle").metadata
157158

@@ -173,7 +174,7 @@ def _flake8_plugins(
173174
yield Plugin(name, version, ep)
174175

175176

176-
def _find_importlib_plugins() -> Generator[Plugin, None, None]:
177+
def _find_importlib_plugins() -> Generator[Plugin]:
177178
# some misconfigured pythons (RHEL) have things on `sys.path` twice
178179
seen = set()
179180
for dist in importlib.metadata.distributions():
@@ -212,7 +213,7 @@ def _find_importlib_plugins() -> Generator[Plugin, None, None]:
212213

213214
def _find_local_plugins(
214215
cfg: configparser.RawConfigParser,
215-
) -> Generator[Plugin, None, None]:
216+
) -> Generator[Plugin]:
216217
for plugin_type in ("extension", "report"):
217218
group = f"flake8.{plugin_type}"
218219
for plugin_s in utils.parse_comma_separated_list(

src/flake8/plugins/pycodestyle.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Generated using ./bin/gen-pycodestyle-plugin."""
2+
23
# fmt: off
34
from __future__ import annotations
45

@@ -55,7 +56,7 @@ def pycodestyle_logical(
5556
previous_unindented_logical_line: Any,
5657
tokens: Any,
5758
verbose: Any,
58-
) -> Generator[tuple[int, str], None, None]:
59+
) -> Generator[tuple[int, str]]:
5960
"""Run pycodestyle logical checks."""
6061
yield from _ambiguous_identifier(logical_line, tokens)
6162
yield from _bare_except(logical_line, noqa)
@@ -93,7 +94,7 @@ def pycodestyle_physical(
9394
noqa: Any,
9495
physical_line: Any,
9596
total_lines: Any,
96-
) -> Generator[tuple[int, str], None, None]:
97+
) -> Generator[tuple[int, str]]:
9798
"""Run pycodestyle physical checks."""
9899
ret = _maximum_line_length(physical_line, max_line_length, multiline, line_number, noqa) # noqa: E501
99100
if ret is not None:

src/flake8/plugins/pyflakes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Plugin built-in to Flake8 to treat pyflakes as a plugin."""
2+
23
from __future__ import annotations
34

45
import argparse
@@ -97,7 +98,7 @@ def parse_options(cls, options: argparse.Namespace) -> None:
9798
cls.builtIns = cls.builtIns.union(options.builtins)
9899
cls.with_doctest = options.doctests
99100

100-
def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]:
101+
def run(self) -> Generator[tuple[int, int, str, type[Any]]]:
101102
"""Run the plugin."""
102103
for message in self.messages:
103104
col = getattr(message, "col", 0)

src/flake8/plugins/reporter.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Functions for constructing the requested report plugin."""
2+
23
from __future__ import annotations
34

45
import argparse

src/flake8/processor.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module containing our file processor that tokenizes a file for checks."""
2+
23
from __future__ import annotations
34

45
import argparse
@@ -127,9 +128,7 @@ def fstring_start(self, lineno: int) -> None: # pragma: >=3.12 cover
127128
"""Signal the beginning of an fstring."""
128129
self._fstring_start = lineno
129130

130-
def multiline_string(
131-
self, token: tokenize.TokenInfo
132-
) -> Generator[str, None, None]:
131+
def multiline_string(self, token: tokenize.TokenInfo) -> Generator[str]:
133132
"""Iterate through the lines of a multiline string."""
134133
if token.type == FSTRING_END: # pragma: >=3.12 cover
135134
start = self._fstring_start
@@ -263,7 +262,7 @@ def keyword_arguments_for(
263262
)
264263
return ret
265264

266-
def generate_tokens(self) -> Generator[tokenize.TokenInfo, None, None]:
265+
def generate_tokens(self) -> Generator[tokenize.TokenInfo]:
267266
"""Tokenize the file and yield the tokens."""
268267
for token in tokenize.generate_tokens(self.next_line):
269268
if token[2][0] > self.total_lines:
@@ -373,9 +372,9 @@ def strip_utf_bom(self) -> None:
373372
return
374373

375374
# If the first byte of the file is a UTF-8 BOM, strip it
376-
if self.lines[0][:1] == "\uFEFF":
375+
if self.lines[0][:1] == "\ufeff":
377376
self.lines[0] = self.lines[0][1:]
378-
elif self.lines[0][:3] == "\xEF\xBB\xBF":
377+
elif self.lines[0][:3] == "\xef\xbb\xbf":
379378
self.lines[0] = self.lines[0][3:]
380379

381380

src/flake8/statistics.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Statistic collection logic for Flake8."""
2+
23
from __future__ import annotations
34

45
from typing import Generator
@@ -36,7 +37,7 @@ def record(self, error: Violation) -> None:
3637

3738
def statistics_for(
3839
self, prefix: str, filename: str | None = None
39-
) -> Generator[Statistic, None, None]:
40+
) -> Generator[Statistic]:
4041
"""Generate statistics for the prefix and filename.
4142
4243
If you have a :class:`Statistics` object that has recorded errors,

src/flake8/style_guide.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Implementation of the StyleGuide used by Flake8."""
2+
23
from __future__ import annotations
34

45
import argparse
@@ -231,7 +232,7 @@ def __init__(
231232

232233
def populate_style_guides_with(
233234
self, options: argparse.Namespace
234-
) -> Generator[StyleGuide, None, None]:
235+
) -> Generator[StyleGuide]:
235236
"""Generate style guides from the per-file-ignores option.
236237
237238
:param options:
@@ -253,9 +254,7 @@ def _style_guide_for(self, filename: str) -> StyleGuide:
253254
)
254255

255256
@contextlib.contextmanager
256-
def processing_file(
257-
self, filename: str
258-
) -> Generator[StyleGuide, None, None]:
257+
def processing_file(self, filename: str) -> Generator[StyleGuide]:
259258
"""Record the fact that we're processing the file's results."""
260259
guide = self.style_guide_for(filename)
261260
with guide.processing_file(filename):
@@ -338,9 +337,7 @@ def copy(
338337
)
339338

340339
@contextlib.contextmanager
341-
def processing_file(
342-
self, filename: str
343-
) -> Generator[StyleGuide, None, None]:
340+
def processing_file(self, filename: str) -> Generator[StyleGuide]:
344341
"""Record the fact that we're processing the file's results."""
345342
self.formatter.beginning(filename)
346343
yield self

src/flake8/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utility methods for flake8."""
2+
23
from __future__ import annotations
34

45
import fnmatch as _fnmatch

src/flake8/violation.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Contains the Violation error class used internally."""
2+
23
from __future__ import annotations
34

45
import functools

0 commit comments

Comments
 (0)