diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 464954c..2657f23 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,12 +20,6 @@ repos: - --add-import - from __future__ import annotations - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.2.2 - hooks: - - id: ruff - - id: ruff-format - - repo: https://github.com/asottile/pyupgrade rev: v3.15.1 hooks: @@ -45,7 +39,17 @@ repos: hooks: - id: validate-pyproject + - repo: https://github.com/psf/black + rev: "24.2.0" + hooks: + - id: black + + - repo: https://github.com/pycqa/autoflake + rev: v2.3.0 + hooks: + - id: autoflake + - repo: https://github.com/fsouza/mirrors-pyright - rev: v1.1.350 + rev: v1.1.353 hooks: - id: pyright diff --git a/autoflake.py b/autoflake.py index 263d764..0581d40 100755 --- a/autoflake.py +++ b/autoflake.py @@ -575,7 +575,8 @@ def filter_code( undefined_names: list[str] = [] if expand_star_imports and not ( # See explanations in #18. - re.search(r"\b__all__\b", source) or re.search(r"\bdel\b", source) + re.search(r"\b__all__\b", source) + or re.search(r"\bdel\b", source) ): marked_star_import_line_numbers = frozenset( star_import_used_line_numbers(messages), @@ -1514,9 +1515,8 @@ def _main( if not success: return 1 - if ( - args["remove_rhs_for_unused_variables"] - and not (args["remove_unused_variables"]) + if args["remove_rhs_for_unused_variables"] and not ( + args["remove_unused_variables"] ): _LOGGER.error( "Using --remove-rhs-for-unused-variables only makes sense when " diff --git a/test_autoflake.py b/test_autoflake.py index 203d5e9..504b035 100755 --- a/test_autoflake.py +++ b/test_autoflake.py @@ -33,7 +33,6 @@ class UnitTests(unittest.TestCase): - """Unit tests.""" def test_imports(self) -> None: @@ -2005,7 +2004,6 @@ def test_exclude(self) -> None: class SystemTests(unittest.TestCase): - """System tests.""" def test_skip_file(self) -> None: @@ -3611,7 +3609,6 @@ def temporary_directory(directory: str = ".", prefix: str = "tmp.") -> Iterator[ class StubFile: - """Fake file that ignores everything.""" def write(*_: Any) -> None: