[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2025-07-21 21:22:25 +00:00
parent 7c9c9cb74d
commit de42a51161
63 changed files with 68 additions and 7 deletions

View file

@ -1,4 +1,5 @@
"""Module for an example Flake8 plugin.""" """Module for an example Flake8 plugin."""
from __future__ import annotations from __future__ import annotations
from .off_by_default import ExampleTwo from .off_by_default import ExampleTwo

View file

@ -1,4 +1,5 @@
"""Our first example plugin.""" """Our first example plugin."""
from __future__ import annotations from __future__ import annotations

View file

@ -1,4 +1,5 @@
"""Our first example plugin.""" """Our first example plugin."""
from __future__ import annotations from __future__ import annotations

View file

@ -16,7 +16,6 @@ classifiers =
Environment :: Console Environment :: Console
Framework :: Flake8 Framework :: Flake8
Intended Audience :: Developers Intended Audience :: Developers
License :: OSI Approved :: MIT License
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 :: Only

View file

@ -1,4 +1,5 @@
"""Packaging logic for Flake8.""" """Packaging logic for Flake8."""
from __future__ import annotations from __future__ import annotations
import os import os

View file

@ -9,6 +9,7 @@ This module
.. autofunction:: flake8.configure_logging .. autofunction:: flake8.configure_logging
""" """
from __future__ import annotations from __future__ import annotations
import logging import logging

View file

@ -1,4 +1,5 @@
"""Module allowing for ``python -m flake8 ...``.""" """Module allowing for ``python -m flake8 ...``."""
from __future__ import annotations from __future__ import annotations
from flake8.main.cli import main from flake8.main.cli import main

View file

@ -3,4 +3,5 @@
This is the only submodule in Flake8 with a guaranteed stable API. All other This is the only submodule in Flake8 with a guaranteed stable API. All other
submodules are considered internal only and are subject to change. submodules are considered internal only and are subject to change.
""" """
from __future__ import annotations from __future__ import annotations

View file

@ -3,6 +3,7 @@
Previously, users would import :func:`get_style_guide` from ``flake8.engine``. 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. In 3.0 we no longer have an "engine" module but we maintain the API from it.
""" """
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Checker Manager and Checker classes.""" """Checker Manager and Checker classes."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Constants that define defaults.""" """Constants that define defaults."""
from __future__ import annotations from __future__ import annotations
import re import re

View file

@ -1,4 +1,5 @@
"""Functions related to discovering paths.""" """Functions related to discovering paths."""
from __future__ import annotations from __future__ import annotations
import logging import logging

View file

@ -1,4 +1,5 @@
"""Exception classes for all of Flake8.""" """Exception classes for all of Flake8."""
from __future__ import annotations from __future__ import annotations

View file

@ -1,2 +1,3 @@
"""Submodule containing the default formatters for Flake8.""" """Submodule containing the default formatters for Flake8."""
from __future__ import annotations from __future__ import annotations

View file

@ -2,6 +2,7 @@
See: https://github.com/pre-commit/pre-commit/blob/cb40e96/pre_commit/color.py See: https://github.com/pre-commit/pre-commit/blob/cb40e96/pre_commit/color.py
""" """
from __future__ import annotations from __future__ import annotations
import sys import sys

View file

@ -1,4 +1,5 @@
"""The base class and interface for all formatting plugins.""" """The base class and interface for all formatting plugins."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Default formatting class for Flake8.""" """Default formatting class for Flake8."""
from __future__ import annotations from __future__ import annotations
from flake8.formatting import base from flake8.formatting import base

View file

@ -1,2 +1,3 @@
"""Module containing the logic for the Flake8 entry-points.""" """Module containing the logic for the Flake8 entry-points."""
from __future__ import annotations from __future__ import annotations

View file

@ -1,4 +1,5 @@
"""Module containing the application logic for Flake8.""" """Module containing the application logic for Flake8."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Command-line implementation of flake8.""" """Command-line implementation of flake8."""
from __future__ import annotations from __future__ import annotations
import sys import sys

View file

@ -1,4 +1,5 @@
"""Module containing the logic for our debugging logic.""" """Module containing the logic for our debugging logic."""
from __future__ import annotations from __future__ import annotations
import platform import platform

View file

@ -1,4 +1,5 @@
"""Contains the logic for all of the default options for Flake8.""" """Contains the logic for all of the default options for Flake8."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -10,4 +10,5 @@
to aggregate configuration into one object used by plugins and Flake8. to aggregate configuration into one object used by plugins and Flake8.
""" """
from __future__ import annotations from __future__ import annotations

View file

@ -3,6 +3,7 @@
This holds the logic that uses the collected and merged config files and This holds the logic that uses the collected and merged config files and
applies the user-specified command-line configuration on top of it. applies the user-specified command-line configuration on top of it.
""" """
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Config handling logic for Flake8.""" """Config handling logic for Flake8."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

View file

@ -1,4 +1,5 @@
"""Option handling and Option management logic.""" """Option handling and Option management logic."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Procedure for parsing args, config, loading plugins.""" """Procedure for parsing args, config, loading plugins."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,2 +1,3 @@
"""Submodule of built-in plugins and plugin managers.""" """Submodule of built-in plugins and plugin managers."""
from __future__ import annotations from __future__ import annotations

View file

@ -1,4 +1,5 @@
"""Functions related to finding and loading plugins.""" """Functions related to finding and loading plugins."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

View file

@ -1,4 +1,5 @@
"""Generated using ./bin/gen-pycodestyle-plugin.""" """Generated using ./bin/gen-pycodestyle-plugin."""
# fmt: off # fmt: off
from __future__ import annotations from __future__ import annotations

View file

@ -1,4 +1,5 @@
"""Plugin built-in to Flake8 to treat pyflakes as a plugin.""" """Plugin built-in to Flake8 to treat pyflakes as a plugin."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Functions for constructing the requested report plugin.""" """Functions for constructing the requested report plugin."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Module containing our file processor that tokenizes a file for checks.""" """Module containing our file processor that tokenizes a file for checks."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse
@ -380,9 +381,9 @@ class FileProcessor:
return return
# If the first byte of the file is a UTF-8 BOM, strip it # If the first byte of the file is a UTF-8 BOM, strip it
if self.lines[0][:1] == "\uFEFF": if self.lines[0][:1] == "\ufeff":
self.lines[0] = self.lines[0][1:] self.lines[0] = self.lines[0][1:]
elif self.lines[0][:3] == "\xEF\xBB\xBF": elif self.lines[0][:3] == "\xef\xbb\xbf":
self.lines[0] = self.lines[0][3:] self.lines[0] = self.lines[0][3:]

View file

@ -1,4 +1,5 @@
"""Statistic collection logic for Flake8.""" """Statistic collection logic for Flake8."""
from __future__ import annotations from __future__ import annotations
from collections.abc import Generator from collections.abc import Generator

View file

@ -1,4 +1,5 @@
"""Implementation of the StyleGuide used by Flake8.""" """Implementation of the StyleGuide used by Flake8."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Utility methods for flake8.""" """Utility methods for flake8."""
from __future__ import annotations from __future__ import annotations
import fnmatch as _fnmatch import fnmatch as _fnmatch

View file

@ -1,4 +1,5 @@
"""Contains the Violation error class used internally.""" """Contains the Violation error class used internally."""
from __future__ import annotations from __future__ import annotations
import functools import functools

View file

@ -1,2 +1,3 @@
"""This is here because mypy doesn't understand PEP 420.""" """This is here because mypy doesn't understand PEP 420."""
from __future__ import annotations from __future__ import annotations

View file

@ -1,4 +1,5 @@
"""Test configuration for py.test.""" """Test configuration for py.test."""
from __future__ import annotations from __future__ import annotations
import sys import sys

View file

@ -1,4 +1,5 @@
"""Module that is off sys.path by default, for testing local-plugin-paths.""" """Module that is off sys.path by default, for testing local-plugin-paths."""
from __future__ import annotations from __future__ import annotations

View file

@ -1,4 +1,5 @@
"""Test aggregation of config files and command-line options.""" """Test aggregation of config files and command-line options."""
from __future__ import annotations from __future__ import annotations
import os import os

View file

@ -1,4 +1,5 @@
"""Integration tests for the legacy api.""" """Integration tests for the legacy api."""
from __future__ import annotations from __future__ import annotations
from flake8.api import legacy from flake8.api import legacy

View file

@ -1,4 +1,5 @@
"""Integration tests for the checker submodule.""" """Integration tests for the checker submodule."""
from __future__ import annotations from __future__ import annotations
import importlib.metadata import importlib.metadata

View file

@ -1,4 +1,5 @@
"""Integration tests for the main entrypoint of flake8.""" """Integration tests for the main entrypoint of flake8."""
from __future__ import annotations from __future__ import annotations
import json import json

View file

@ -1,4 +1,5 @@
"""Integration tests for plugin loading.""" """Integration tests for plugin loading."""
from __future__ import annotations from __future__ import annotations
import sys import sys

View file

@ -1,4 +1,5 @@
"""Shared fixtures between unit tests.""" """Shared fixtures between unit tests."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests for the Application class.""" """Tests for the Application class."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests for the BaseFormatter object.""" """Tests for the BaseFormatter object."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests for the Manager object for FileCheckers.""" """Tests for the Manager object for FileCheckers."""
from __future__ import annotations from __future__ import annotations
import errno import errno

View file

@ -1,4 +1,5 @@
"""Tests for the flake8.style_guide.DecisionEngine class.""" """Tests for the flake8.style_guide.DecisionEngine class."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests for the flake8.exceptions module.""" """Tests for the flake8.exceptions module."""
from __future__ import annotations from __future__ import annotations
import pickle import pickle

View file

@ -1,4 +1,5 @@
"""Unit tests for the FileChecker class.""" """Unit tests for the FileChecker class."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests for the FileProcessor class.""" """Tests for the FileProcessor class."""
from __future__ import annotations from __future__ import annotations
import ast import ast
@ -52,8 +53,8 @@ def test_read_lines_unknown_encoding(tmpdir, default_options):
@pytest.mark.parametrize( @pytest.mark.parametrize(
"first_line", "first_line",
[ [
'\xEF\xBB\xBF"""Module docstring."""\n', '\xef\xbb\xbf"""Module docstring."""\n',
'\uFEFF"""Module docstring."""\n', '\ufeff"""Module docstring."""\n',
], ],
) )
def test_strip_utf_bom(first_line, default_options): def test_strip_utf_bom(first_line, default_options):
@ -67,8 +68,8 @@ def test_strip_utf_bom(first_line, default_options):
@pytest.mark.parametrize( @pytest.mark.parametrize(
"lines, expected", "lines, expected",
[ [
(['\xEF\xBB\xBF"""Module docstring."""\n'], False), (['\xef\xbb\xbf"""Module docstring."""\n'], False),
(['\uFEFF"""Module docstring."""\n'], False), (['\ufeff"""Module docstring."""\n'], False),
(["#!/usr/bin/python", "# flake8 is great", "a = 1"], False), (["#!/usr/bin/python", "# flake8 is great", "a = 1"], False),
(["#!/usr/bin/python", "# flake8: noqa", "a = 1"], True), (["#!/usr/bin/python", "# flake8: noqa", "a = 1"], True),
(["#!/usr/bin/python", "# flake8:noqa", "a = 1"], True), (["#!/usr/bin/python", "# flake8:noqa", "a = 1"], True),

View file

@ -1,4 +1,5 @@
"""Tests for the FilenameOnly formatter object.""" """Tests for the FilenameOnly formatter object."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests for Flake8's legacy API.""" """Tests for Flake8's legacy API."""
from __future__ import annotations from __future__ import annotations
from unittest import mock from unittest import mock

View file

@ -1,4 +1,5 @@
"""Tests for the Nothing formatter obbject.""" """Tests for the Nothing formatter obbject."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Unit tests for flake8.options.manager.Option.""" """Unit tests for flake8.options.manager.Option."""
from __future__ import annotations from __future__ import annotations
import functools import functools

View file

@ -1,4 +1,5 @@
"""Unit tests for flake.options.manager.OptionManager.""" """Unit tests for flake.options.manager.OptionManager."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests of pyflakes monkey patches.""" """Tests of pyflakes monkey patches."""
from __future__ import annotations from __future__ import annotations
import ast import ast

View file

@ -1,4 +1,5 @@
"""Tests for the statistics module in Flake8.""" """Tests for the statistics module in Flake8."""
from __future__ import annotations from __future__ import annotations
import pytest import pytest

View file

@ -1,4 +1,5 @@
"""Tests for the flake8.style_guide.StyleGuide class.""" """Tests for the flake8.style_guide.StyleGuide class."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View file

@ -1,4 +1,5 @@
"""Tests for flake8's utils module.""" """Tests for flake8's utils module."""
from __future__ import annotations from __future__ import annotations
import io import io

View file

@ -1,4 +1,5 @@
"""Tests for the flake8.violation.Violation class.""" """Tests for the flake8.violation.Violation class."""
from __future__ import annotations from __future__ import annotations
from unittest import mock from unittest import mock