From a5cc306fd4989ffd8a2ded151c74d0fc8a3bf254 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 00:36:27 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v5.0.0) - [github.com/asottile/setup-cfg-fmt: v2.5.0 → v2.7.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.5.0...v2.7.0) - [github.com/asottile/reorder-python-imports: v3.12.0 → v3.14.0](https://github.com/asottile/reorder-python-imports/compare/v3.12.0...v3.14.0) - [github.com/asottile/pyupgrade: v3.15.0 → v3.19.0](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.19.0) - [github.com/psf/black: 23.12.1 → 24.10.0](https://github.com/psf/black/compare/23.12.1...24.10.0) - [github.com/PyCQA/flake8: 7.0.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.1) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.13.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.13.0) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad60be1d..238422c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-yaml - id: debug-statements @@ -8,11 +8,11 @@ repos: - id: trailing-whitespace exclude: ^tests/fixtures/ - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.5.0 + rev: v2.7.0 hooks: - id: setup-cfg-fmt - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + rev: v3.14.0 hooks: - id: reorder-python-imports args: [ @@ -21,21 +21,21 @@ repos: --add-import, 'from __future__ import annotations', ] - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.19.0 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.10.0 hooks: - id: black args: [--line-length=79] - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.13.0 hooks: - id: mypy exclude: ^(docs/|example-plugin/) From 4df5b9ac1beeef1320e8146002393889e3a1ec0b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 00:37:05 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- bin/gen-pycodestyle-plugin | 2 +- example-plugin/src/flake8_example_plugin/__init__.py | 1 + .../src/flake8_example_plugin/off_by_default.py | 1 + .../src/flake8_example_plugin/on_by_default.py | 1 + setup.cfg | 2 +- setup.py | 1 + src/flake8/__init__.py | 1 + src/flake8/__main__.py | 1 + src/flake8/api/__init__.py | 1 + src/flake8/api/legacy.py | 1 + src/flake8/checker.py | 3 ++- src/flake8/defaults.py | 1 + src/flake8/discover_files.py | 5 +++-- src/flake8/exceptions.py | 1 + src/flake8/formatting/__init__.py | 1 + src/flake8/formatting/_windows_color.py | 1 + src/flake8/formatting/base.py | 1 + src/flake8/formatting/default.py | 1 + src/flake8/main/__init__.py | 1 + src/flake8/main/application.py | 1 + src/flake8/main/cli.py | 1 + src/flake8/main/debug.py | 1 + src/flake8/main/options.py | 1 + src/flake8/options/__init__.py | 1 + src/flake8/options/aggregator.py | 1 + src/flake8/options/config.py | 1 + src/flake8/options/manager.py | 1 + src/flake8/options/parse_args.py | 1 + src/flake8/plugins/__init__.py | 1 + src/flake8/plugins/finder.py | 9 +++++---- src/flake8/plugins/pycodestyle.py | 5 +++-- src/flake8/plugins/pyflakes.py | 3 ++- src/flake8/plugins/reporter.py | 1 + src/flake8/processor.py | 7 +++---- src/flake8/statistics.py | 3 ++- src/flake8/style_guide.py | 11 ++++------- src/flake8/utils.py | 1 + src/flake8/violation.py | 1 + tests/__init__.py | 1 + tests/conftest.py | 1 + tests/integration/subdir/aplugin.py | 1 + tests/integration/test_aggregator.py | 1 + tests/integration/test_api_legacy.py | 1 + tests/integration/test_checker.py | 1 + tests/integration/test_main.py | 1 + tests/integration/test_plugins.py | 1 + tests/unit/conftest.py | 1 + tests/unit/test_application.py | 1 + tests/unit/test_base_formatter.py | 1 + tests/unit/test_checker_manager.py | 1 + tests/unit/test_decision_engine.py | 1 + tests/unit/test_exceptions.py | 1 + tests/unit/test_file_checker.py | 1 + tests/unit/test_file_processor.py | 1 + tests/unit/test_filenameonly_formatter.py | 1 + tests/unit/test_legacy_api.py | 1 + tests/unit/test_nothing_formatter.py | 1 + tests/unit/test_option.py | 1 + tests/unit/test_option_manager.py | 1 + tests/unit/test_pyflakes_codes.py | 1 + tests/unit/test_statistics.py | 1 + tests/unit/test_style_guide.py | 1 + tests/unit/test_utils.py | 1 + tests/unit/test_violation.py | 1 + 64 files changed, 80 insertions(+), 24 deletions(-) diff --git a/bin/gen-pycodestyle-plugin b/bin/gen-pycodestyle-plugin index 8bc2efce..1f182bc9 100755 --- a/bin/gen-pycodestyle-plugin +++ b/bin/gen-pycodestyle-plugin @@ -42,7 +42,7 @@ class Call(NamedTuple): return cls(func.__name__, inspect.isgeneratorfunction(func), params) -def lines() -> Generator[str, None, None]: +def lines() -> Generator[str]: logical = [] physical = [] diff --git a/example-plugin/src/flake8_example_plugin/__init__.py b/example-plugin/src/flake8_example_plugin/__init__.py index 47851da6..8de9c4d4 100644 --- a/example-plugin/src/flake8_example_plugin/__init__.py +++ b/example-plugin/src/flake8_example_plugin/__init__.py @@ -1,4 +1,5 @@ """Module for an example Flake8 plugin.""" + from __future__ import annotations from .off_by_default import ExampleTwo diff --git a/example-plugin/src/flake8_example_plugin/off_by_default.py b/example-plugin/src/flake8_example_plugin/off_by_default.py index d140ca1d..56e781f1 100644 --- a/example-plugin/src/flake8_example_plugin/off_by_default.py +++ b/example-plugin/src/flake8_example_plugin/off_by_default.py @@ -1,4 +1,5 @@ """Our first example plugin.""" + from __future__ import annotations diff --git a/example-plugin/src/flake8_example_plugin/on_by_default.py b/example-plugin/src/flake8_example_plugin/on_by_default.py index d2da1268..8f5c8189 100644 --- a/example-plugin/src/flake8_example_plugin/on_by_default.py +++ b/example-plugin/src/flake8_example_plugin/on_by_default.py @@ -1,4 +1,5 @@ """Our first example plugin.""" + from __future__ import annotations diff --git a/setup.cfg b/setup.cfg index 28e6f933..688e3490 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ install_requires = mccabe>=0.7.0,<0.8.0 pycodestyle>=2.12.0,<2.13.0 pyflakes>=3.2.0,<3.3.0 -python_requires = >=3.8.1 +python_requires = >=3.9 package_dir = =src diff --git a/setup.py b/setup.py index 253a22ee..548a6d8a 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ """Packaging logic for Flake8.""" + from __future__ import annotations import os diff --git a/src/flake8/__init__.py b/src/flake8/__init__.py index 101eafe7..7a1ba999 100644 --- a/src/flake8/__init__.py +++ b/src/flake8/__init__.py @@ -9,6 +9,7 @@ .. autofunction:: flake8.configure_logging """ + from __future__ import annotations import logging diff --git a/src/flake8/__main__.py b/src/flake8/__main__.py index 8f7e7c9d..d318d666 100644 --- a/src/flake8/__main__.py +++ b/src/flake8/__main__.py @@ -1,4 +1,5 @@ """Module allowing for ``python -m flake8 ...``.""" + from __future__ import annotations from flake8.main.cli import main diff --git a/src/flake8/api/__init__.py b/src/flake8/api/__init__.py index c5f9711a..7993de6a 100644 --- a/src/flake8/api/__init__.py +++ b/src/flake8/api/__init__.py @@ -3,4 +3,5 @@ This is the only submodule in Flake8 with a guaranteed stable API. All other submodules are considered internal only and are subject to change. """ + from __future__ import annotations diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py index 446df293..b94a771d 100644 --- a/src/flake8/api/legacy.py +++ b/src/flake8/api/legacy.py @@ -3,6 +3,7 @@ Previously, users would import :func:`get_style_guide` from ``flake8.engine``. In 3.0 we no longer have an "engine" module but we maintain the API from it. """ + from __future__ import annotations import argparse diff --git a/src/flake8/checker.py b/src/flake8/checker.py index 329a2cc3..cc125385 100644 --- a/src/flake8/checker.py +++ b/src/flake8/checker.py @@ -1,4 +1,5 @@ """Checker Manager and Checker classes.""" + from __future__ import annotations import argparse @@ -53,7 +54,7 @@ @contextlib.contextmanager def _mp_prefork( plugins: Checkers, options: argparse.Namespace -) -> Generator[None, None, None]: +) -> Generator[None]: # we can save significant startup work w/ `fork` multiprocessing global _mp_plugins, _mp_options _mp_plugins, _mp_options = plugins, options diff --git a/src/flake8/defaults.py b/src/flake8/defaults.py index 57abda11..d895c54f 100644 --- a/src/flake8/defaults.py +++ b/src/flake8/defaults.py @@ -1,4 +1,5 @@ """Constants that define defaults.""" + from __future__ import annotations import re diff --git a/src/flake8/discover_files.py b/src/flake8/discover_files.py index 580d5fdf..11111b05 100644 --- a/src/flake8/discover_files.py +++ b/src/flake8/discover_files.py @@ -1,4 +1,5 @@ """Functions related to discovering paths.""" + from __future__ import annotations import logging @@ -16,7 +17,7 @@ def _filenames_from( arg: str, *, predicate: Callable[[str], bool], -) -> Generator[str, None, None]: +) -> Generator[str]: """Generate filenames from an argument. :param arg: @@ -55,7 +56,7 @@ def expand_paths( stdin_display_name: str, filename_patterns: Sequence[str], exclude: Sequence[str], -) -> Generator[str, None, None]: +) -> Generator[str]: """Expand out ``paths`` from commandline to the lintable files.""" if not paths: paths = ["."] diff --git a/src/flake8/exceptions.py b/src/flake8/exceptions.py index 18646e7e..533923e0 100644 --- a/src/flake8/exceptions.py +++ b/src/flake8/exceptions.py @@ -1,4 +1,5 @@ """Exception classes for all of Flake8.""" + from __future__ import annotations diff --git a/src/flake8/formatting/__init__.py b/src/flake8/formatting/__init__.py index 732d0b61..f6bae560 100644 --- a/src/flake8/formatting/__init__.py +++ b/src/flake8/formatting/__init__.py @@ -1,2 +1,3 @@ """Submodule containing the default formatters for Flake8.""" + from __future__ import annotations diff --git a/src/flake8/formatting/_windows_color.py b/src/flake8/formatting/_windows_color.py index a06fdb94..6ee96ba8 100644 --- a/src/flake8/formatting/_windows_color.py +++ b/src/flake8/formatting/_windows_color.py @@ -2,6 +2,7 @@ See: https://github.com/pre-commit/pre-commit/blob/cb40e96/pre_commit/color.py """ + from __future__ import annotations import sys diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py index d986d651..257f4b78 100644 --- a/src/flake8/formatting/base.py +++ b/src/flake8/formatting/base.py @@ -1,4 +1,5 @@ """The base class and interface for all formatting plugins.""" + from __future__ import annotations import argparse diff --git a/src/flake8/formatting/default.py b/src/flake8/formatting/default.py index b5d08ff0..4386476c 100644 --- a/src/flake8/formatting/default.py +++ b/src/flake8/formatting/default.py @@ -1,4 +1,5 @@ """Default formatting class for Flake8.""" + from __future__ import annotations from flake8.formatting import base diff --git a/src/flake8/main/__init__.py b/src/flake8/main/__init__.py index 85bcff42..55528b00 100644 --- a/src/flake8/main/__init__.py +++ b/src/flake8/main/__init__.py @@ -1,2 +1,3 @@ """Module containing the logic for the Flake8 entry-points.""" + from __future__ import annotations diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index b6bfae37..df454ab8 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -1,4 +1,5 @@ """Module containing the application logic for Flake8.""" + from __future__ import annotations import argparse diff --git a/src/flake8/main/cli.py b/src/flake8/main/cli.py index 01a67ac9..0f335762 100644 --- a/src/flake8/main/cli.py +++ b/src/flake8/main/cli.py @@ -1,4 +1,5 @@ """Command-line implementation of flake8.""" + from __future__ import annotations import sys diff --git a/src/flake8/main/debug.py b/src/flake8/main/debug.py index c3a8b0b7..389523d3 100644 --- a/src/flake8/main/debug.py +++ b/src/flake8/main/debug.py @@ -1,4 +1,5 @@ """Module containing the logic for our debugging logic.""" + from __future__ import annotations import platform diff --git a/src/flake8/main/options.py b/src/flake8/main/options.py index 9d57321b..80c02a3d 100644 --- a/src/flake8/main/options.py +++ b/src/flake8/main/options.py @@ -1,4 +1,5 @@ """Contains the logic for all of the default options for Flake8.""" + from __future__ import annotations import argparse diff --git a/src/flake8/options/__init__.py b/src/flake8/options/__init__.py index 3578223b..b98a2e7b 100644 --- a/src/flake8/options/__init__.py +++ b/src/flake8/options/__init__.py @@ -10,4 +10,5 @@ to aggregate configuration into one object used by plugins and Flake8. """ + from __future__ import annotations diff --git a/src/flake8/options/aggregator.py b/src/flake8/options/aggregator.py index af8e7449..b621fe19 100644 --- a/src/flake8/options/aggregator.py +++ b/src/flake8/options/aggregator.py @@ -3,6 +3,7 @@ This holds the logic that uses the collected and merged config files and applies the user-specified command-line configuration on top of it. """ + from __future__ import annotations import argparse diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py index b51949c2..73d33fbb 100644 --- a/src/flake8/options/config.py +++ b/src/flake8/options/config.py @@ -1,4 +1,5 @@ """Config handling logic for Flake8.""" + from __future__ import annotations import configparser diff --git a/src/flake8/options/manager.py b/src/flake8/options/manager.py index 4fd26b29..f945eff7 100644 --- a/src/flake8/options/manager.py +++ b/src/flake8/options/manager.py @@ -1,4 +1,5 @@ """Option handling and Option management logic.""" + from __future__ import annotations import argparse diff --git a/src/flake8/options/parse_args.py b/src/flake8/options/parse_args.py index e3f8795f..ec4637b0 100644 --- a/src/flake8/options/parse_args.py +++ b/src/flake8/options/parse_args.py @@ -1,4 +1,5 @@ """Procedure for parsing args, config, loading plugins.""" + from __future__ import annotations import argparse diff --git a/src/flake8/plugins/__init__.py b/src/flake8/plugins/__init__.py index b5403133..da6b43da 100644 --- a/src/flake8/plugins/__init__.py +++ b/src/flake8/plugins/__init__.py @@ -1,2 +1,3 @@ """Submodule of built-in plugins and plugin managers.""" + from __future__ import annotations diff --git a/src/flake8/plugins/finder.py b/src/flake8/plugins/finder.py index 380ec3ac..162b4c2d 100644 --- a/src/flake8/plugins/finder.py +++ b/src/flake8/plugins/finder.py @@ -1,4 +1,5 @@ """Functions related to finding and loading plugins.""" + from __future__ import annotations import configparser @@ -68,7 +69,7 @@ class Plugins(NamedTuple): reporters: dict[str, LoadedPlugin] disabled: list[LoadedPlugin] - def all_plugins(self) -> Generator[LoadedPlugin, None, None]: + def all_plugins(self) -> Generator[LoadedPlugin]: """Return an iterator over all :class:`LoadedPlugin`s.""" yield from self.checkers.tree yield from self.checkers.logical_line @@ -151,7 +152,7 @@ def _flake8_plugins( eps: Iterable[importlib.metadata.EntryPoint], name: str, version: str, -) -> Generator[Plugin, None, None]: +) -> Generator[Plugin]: pyflakes_meta = importlib.metadata.distribution("pyflakes").metadata pycodestyle_meta = importlib.metadata.distribution("pycodestyle").metadata @@ -173,7 +174,7 @@ def _flake8_plugins( yield Plugin(name, version, ep) -def _find_importlib_plugins() -> Generator[Plugin, None, None]: +def _find_importlib_plugins() -> Generator[Plugin]: # some misconfigured pythons (RHEL) have things on `sys.path` twice seen = set() for dist in importlib.metadata.distributions(): @@ -212,7 +213,7 @@ def _find_importlib_plugins() -> Generator[Plugin, None, None]: def _find_local_plugins( cfg: configparser.RawConfigParser, -) -> Generator[Plugin, None, None]: +) -> Generator[Plugin]: for plugin_type in ("extension", "report"): group = f"flake8.{plugin_type}" for plugin_s in utils.parse_comma_separated_list( diff --git a/src/flake8/plugins/pycodestyle.py b/src/flake8/plugins/pycodestyle.py index 9e1d2bbb..9f74efb1 100644 --- a/src/flake8/plugins/pycodestyle.py +++ b/src/flake8/plugins/pycodestyle.py @@ -1,4 +1,5 @@ """Generated using ./bin/gen-pycodestyle-plugin.""" + # fmt: off from __future__ import annotations @@ -55,7 +56,7 @@ def pycodestyle_logical( previous_unindented_logical_line: Any, tokens: Any, verbose: Any, -) -> Generator[tuple[int, str], None, None]: +) -> Generator[tuple[int, str]]: """Run pycodestyle logical checks.""" yield from _ambiguous_identifier(logical_line, tokens) yield from _bare_except(logical_line, noqa) @@ -93,7 +94,7 @@ def pycodestyle_physical( noqa: Any, physical_line: Any, total_lines: Any, -) -> Generator[tuple[int, str], None, None]: +) -> Generator[tuple[int, str]]: """Run pycodestyle physical checks.""" ret = _maximum_line_length(physical_line, max_line_length, multiline, line_number, noqa) # noqa: E501 if ret is not None: diff --git a/src/flake8/plugins/pyflakes.py b/src/flake8/plugins/pyflakes.py index 6c576191..e38abad4 100644 --- a/src/flake8/plugins/pyflakes.py +++ b/src/flake8/plugins/pyflakes.py @@ -1,4 +1,5 @@ """Plugin built-in to Flake8 to treat pyflakes as a plugin.""" + from __future__ import annotations import argparse @@ -97,7 +98,7 @@ def parse_options(cls, options: argparse.Namespace) -> None: cls.builtIns = cls.builtIns.union(options.builtins) cls.with_doctest = options.doctests - def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: + def run(self) -> Generator[tuple[int, int, str, type[Any]]]: """Run the plugin.""" for message in self.messages: col = getattr(message, "col", 0) diff --git a/src/flake8/plugins/reporter.py b/src/flake8/plugins/reporter.py index a5749c03..75db99f4 100644 --- a/src/flake8/plugins/reporter.py +++ b/src/flake8/plugins/reporter.py @@ -1,4 +1,5 @@ """Functions for constructing the requested report plugin.""" + from __future__ import annotations import argparse diff --git a/src/flake8/processor.py b/src/flake8/processor.py index e44547b3..3292adfe 100644 --- a/src/flake8/processor.py +++ b/src/flake8/processor.py @@ -1,4 +1,5 @@ """Module containing our file processor that tokenizes a file for checks.""" + from __future__ import annotations import argparse @@ -127,9 +128,7 @@ def fstring_start(self, lineno: int) -> None: # pragma: >=3.12 cover """Signal the beginning of an fstring.""" self._fstring_start = lineno - def multiline_string( - self, token: tokenize.TokenInfo - ) -> Generator[str, None, None]: + def multiline_string(self, token: tokenize.TokenInfo) -> Generator[str]: """Iterate through the lines of a multiline string.""" if token.type == FSTRING_END: # pragma: >=3.12 cover start = self._fstring_start @@ -263,7 +262,7 @@ def keyword_arguments_for( ) return ret - def generate_tokens(self) -> Generator[tokenize.TokenInfo, None, None]: + def generate_tokens(self) -> Generator[tokenize.TokenInfo]: """Tokenize the file and yield the tokens.""" for token in tokenize.generate_tokens(self.next_line): if token[2][0] > self.total_lines: diff --git a/src/flake8/statistics.py b/src/flake8/statistics.py index a33e6a64..b67e3c41 100644 --- a/src/flake8/statistics.py +++ b/src/flake8/statistics.py @@ -1,4 +1,5 @@ """Statistic collection logic for Flake8.""" + from __future__ import annotations from typing import Generator @@ -36,7 +37,7 @@ def record(self, error: Violation) -> None: def statistics_for( self, prefix: str, filename: str | None = None - ) -> Generator[Statistic, None, None]: + ) -> Generator[Statistic]: """Generate statistics for the prefix and filename. If you have a :class:`Statistics` object that has recorded errors, diff --git a/src/flake8/style_guide.py b/src/flake8/style_guide.py index a4094840..ac95fc12 100644 --- a/src/flake8/style_guide.py +++ b/src/flake8/style_guide.py @@ -1,4 +1,5 @@ """Implementation of the StyleGuide used by Flake8.""" + from __future__ import annotations import argparse @@ -231,7 +232,7 @@ def __init__( def populate_style_guides_with( self, options: argparse.Namespace - ) -> Generator[StyleGuide, None, None]: + ) -> Generator[StyleGuide]: """Generate style guides from the per-file-ignores option. :param options: @@ -253,9 +254,7 @@ def _style_guide_for(self, filename: str) -> StyleGuide: ) @contextlib.contextmanager - def processing_file( - self, filename: str - ) -> Generator[StyleGuide, None, None]: + def processing_file(self, filename: str) -> Generator[StyleGuide]: """Record the fact that we're processing the file's results.""" guide = self.style_guide_for(filename) with guide.processing_file(filename): @@ -338,9 +337,7 @@ def copy( ) @contextlib.contextmanager - def processing_file( - self, filename: str - ) -> Generator[StyleGuide, None, None]: + def processing_file(self, filename: str) -> Generator[StyleGuide]: """Record the fact that we're processing the file's results.""" self.formatter.beginning(filename) yield self diff --git a/src/flake8/utils.py b/src/flake8/utils.py index afc3896d..21d3ed5a 100644 --- a/src/flake8/utils.py +++ b/src/flake8/utils.py @@ -1,4 +1,5 @@ """Utility methods for flake8.""" + from __future__ import annotations import fnmatch as _fnmatch diff --git a/src/flake8/violation.py b/src/flake8/violation.py index 96161d4e..b907ea8c 100644 --- a/src/flake8/violation.py +++ b/src/flake8/violation.py @@ -1,4 +1,5 @@ """Contains the Violation error class used internally.""" + from __future__ import annotations import functools diff --git a/tests/__init__.py b/tests/__init__.py index ee1f2a01..fc6434e4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,2 +1,3 @@ """This is here because mypy doesn't understand PEP 420.""" + from __future__ import annotations diff --git a/tests/conftest.py b/tests/conftest.py index ac413fbb..40b6c6a5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """Test configuration for py.test.""" + from __future__ import annotations import sys diff --git a/tests/integration/subdir/aplugin.py b/tests/integration/subdir/aplugin.py index 97b06a90..11450a9d 100644 --- a/tests/integration/subdir/aplugin.py +++ b/tests/integration/subdir/aplugin.py @@ -1,4 +1,5 @@ """Module that is off sys.path by default, for testing local-plugin-paths.""" + from __future__ import annotations diff --git a/tests/integration/test_aggregator.py b/tests/integration/test_aggregator.py index 006ac5fa..a8f5f188 100644 --- a/tests/integration/test_aggregator.py +++ b/tests/integration/test_aggregator.py @@ -1,4 +1,5 @@ """Test aggregation of config files and command-line options.""" + from __future__ import annotations import os diff --git a/tests/integration/test_api_legacy.py b/tests/integration/test_api_legacy.py index b386bd5d..d30fb4a9 100644 --- a/tests/integration/test_api_legacy.py +++ b/tests/integration/test_api_legacy.py @@ -1,4 +1,5 @@ """Integration tests for the legacy api.""" + from __future__ import annotations from flake8.api import legacy diff --git a/tests/integration/test_checker.py b/tests/integration/test_checker.py index a585f5ac..2da53a83 100644 --- a/tests/integration/test_checker.py +++ b/tests/integration/test_checker.py @@ -1,4 +1,5 @@ """Integration tests for the checker submodule.""" + from __future__ import annotations import importlib.metadata diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py index 68b93cb3..6fa1741d 100644 --- a/tests/integration/test_main.py +++ b/tests/integration/test_main.py @@ -1,4 +1,5 @@ """Integration tests for the main entrypoint of flake8.""" + from __future__ import annotations import json diff --git a/tests/integration/test_plugins.py b/tests/integration/test_plugins.py index 90ca555a..c7225571 100644 --- a/tests/integration/test_plugins.py +++ b/tests/integration/test_plugins.py @@ -1,4 +1,5 @@ """Integration tests for plugin loading.""" + from __future__ import annotations import sys diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 0f8386a4..a1e58adf 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -1,4 +1,5 @@ """Shared fixtures between unit tests.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_application.py b/tests/unit/test_application.py index 04147ec8..f0a37966 100644 --- a/tests/unit/test_application.py +++ b/tests/unit/test_application.py @@ -1,4 +1,5 @@ """Tests for the Application class.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_base_formatter.py b/tests/unit/test_base_formatter.py index 5b573352..b7d259e2 100644 --- a/tests/unit/test_base_formatter.py +++ b/tests/unit/test_base_formatter.py @@ -1,4 +1,5 @@ """Tests for the BaseFormatter object.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_checker_manager.py b/tests/unit/test_checker_manager.py index 68dd82aa..a501422d 100644 --- a/tests/unit/test_checker_manager.py +++ b/tests/unit/test_checker_manager.py @@ -1,4 +1,5 @@ """Tests for the Manager object for FileCheckers.""" + from __future__ import annotations import errno diff --git a/tests/unit/test_decision_engine.py b/tests/unit/test_decision_engine.py index d543d5ec..95ec1ea3 100644 --- a/tests/unit/test_decision_engine.py +++ b/tests/unit/test_decision_engine.py @@ -1,4 +1,5 @@ """Tests for the flake8.style_guide.DecisionEngine class.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_exceptions.py b/tests/unit/test_exceptions.py index 99b298bc..6998c04d 100644 --- a/tests/unit/test_exceptions.py +++ b/tests/unit/test_exceptions.py @@ -1,4 +1,5 @@ """Tests for the flake8.exceptions module.""" + from __future__ import annotations import pickle diff --git a/tests/unit/test_file_checker.py b/tests/unit/test_file_checker.py index 627a9361..30983829 100644 --- a/tests/unit/test_file_checker.py +++ b/tests/unit/test_file_checker.py @@ -1,4 +1,5 @@ """Unit tests for the FileChecker class.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index a90c6284..b6efc1f0 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -1,4 +1,5 @@ """Tests for the FileProcessor class.""" + from __future__ import annotations import ast diff --git a/tests/unit/test_filenameonly_formatter.py b/tests/unit/test_filenameonly_formatter.py index 77f75b94..2ccf23f7 100644 --- a/tests/unit/test_filenameonly_formatter.py +++ b/tests/unit/test_filenameonly_formatter.py @@ -1,4 +1,5 @@ """Tests for the FilenameOnly formatter object.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_legacy_api.py b/tests/unit/test_legacy_api.py index c6af6301..aa408103 100644 --- a/tests/unit/test_legacy_api.py +++ b/tests/unit/test_legacy_api.py @@ -1,4 +1,5 @@ """Tests for Flake8's legacy API.""" + from __future__ import annotations from unittest import mock diff --git a/tests/unit/test_nothing_formatter.py b/tests/unit/test_nothing_formatter.py index 76929fd7..b6c6e23d 100644 --- a/tests/unit/test_nothing_formatter.py +++ b/tests/unit/test_nothing_formatter.py @@ -1,4 +1,5 @@ """Tests for the Nothing formatter obbject.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_option.py b/tests/unit/test_option.py index 4b3070dc..8e008b7d 100644 --- a/tests/unit/test_option.py +++ b/tests/unit/test_option.py @@ -1,4 +1,5 @@ """Unit tests for flake8.options.manager.Option.""" + from __future__ import annotations import functools diff --git a/tests/unit/test_option_manager.py b/tests/unit/test_option_manager.py index 92266f3a..87a76ff5 100644 --- a/tests/unit/test_option_manager.py +++ b/tests/unit/test_option_manager.py @@ -1,4 +1,5 @@ """Unit tests for flake.options.manager.OptionManager.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_pyflakes_codes.py b/tests/unit/test_pyflakes_codes.py index 444008a2..f9bca9b9 100644 --- a/tests/unit/test_pyflakes_codes.py +++ b/tests/unit/test_pyflakes_codes.py @@ -1,4 +1,5 @@ """Tests of pyflakes monkey patches.""" + from __future__ import annotations import ast diff --git a/tests/unit/test_statistics.py b/tests/unit/test_statistics.py index 261f360e..9f606664 100644 --- a/tests/unit/test_statistics.py +++ b/tests/unit/test_statistics.py @@ -1,4 +1,5 @@ """Tests for the statistics module in Flake8.""" + from __future__ import annotations import pytest diff --git a/tests/unit/test_style_guide.py b/tests/unit/test_style_guide.py index 94fcb260..c8eae3d6 100644 --- a/tests/unit/test_style_guide.py +++ b/tests/unit/test_style_guide.py @@ -1,4 +1,5 @@ """Tests for the flake8.style_guide.StyleGuide class.""" + from __future__ import annotations import argparse diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 82eef63e..773b7c9d 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -1,4 +1,5 @@ """Tests for flake8's utils module.""" + from __future__ import annotations import io diff --git a/tests/unit/test_violation.py b/tests/unit/test_violation.py index 1b4852be..d7f0b4be 100644 --- a/tests/unit/test_violation.py +++ b/tests/unit/test_violation.py @@ -1,4 +1,5 @@ """Tests for the flake8.violation.Violation class.""" + from __future__ import annotations from unittest import mock