From 70908c8309e4674c573914b308542a3025313421 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:58:18 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- py-common/src/toml_fmt_common/__init__.py | 4 +--- py-common/tests/test_app.py | 2 -- pyproject-fmt/src/pyproject_fmt/__init__.py | 1 - pyproject-fmt/src/pyproject_fmt/__main__.py | 6 +++--- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/py-common/src/toml_fmt_common/__init__.py b/py-common/src/toml_fmt_common/__init__.py index 1745aa8..ad21358 100644 --- a/py-common/src/toml_fmt_common/__init__.py +++ b/py-common/src/toml_fmt_common/__init__.py @@ -88,8 +88,6 @@ def format(self, text: str, opt: T) -> str: raise NotImplementedError - - def run(info: TOMLFormatter[T], args: Sequence[str] | None = None) -> int: """ Run the formatter. @@ -197,7 +195,7 @@ def _build_cli(of: TOMLFormatter[T]) -> ArgumentParser: help="number of spaces to use for indentation", metavar="count", ) - of.add_format_flags(format_group) # type: ignore[arg-type] + of.add_format_flags(format_group) # type: ignore[arg-type] msg = "pyproject.toml file(s) to format, use '-' to read from stdin" parser.add_argument( "inputs", diff --git a/py-common/tests/test_app.py b/py-common/tests/test_app.py index dfc7ce9..1937eb4 100644 --- a/py-common/tests/test_app.py +++ b/py-common/tests/test_app.py @@ -5,7 +5,6 @@ from typing import TYPE_CHECKING import pytest - from toml_fmt_common import GREEN, RED, RESET, FmtNamespace, TOMLFormatter, run if TYPE_CHECKING: @@ -20,7 +19,6 @@ class DumpNamespace(FmtNamespace): class Dumb(TOMLFormatter[DumpNamespace]): - def __init__(self) -> None: super().__init__(DumpNamespace()) diff --git a/pyproject-fmt/src/pyproject_fmt/__init__.py b/pyproject-fmt/src/pyproject_fmt/__init__.py index 408615a..578a4cf 100644 --- a/pyproject-fmt/src/pyproject_fmt/__init__.py +++ b/pyproject-fmt/src/pyproject_fmt/__init__.py @@ -4,7 +4,6 @@ from .__main__ import run - __all__ = [ "run", ] diff --git a/pyproject-fmt/src/pyproject_fmt/__main__.py b/pyproject-fmt/src/pyproject_fmt/__main__.py index f0f41e5..d05ea1f 100644 --- a/pyproject-fmt/src/pyproject_fmt/__main__.py +++ b/pyproject-fmt/src/pyproject_fmt/__main__.py @@ -1,13 +1,12 @@ """Main entry point for the formatter.""" -from __future__ import annotations from __future__ import annotations from argparse import ArgumentParser, ArgumentTypeError from typing import Sequence -from .toml_fmt_common import TOMLFormatter, FmtNamespace, run from ._lib import Settings, format_toml +from .toml_fmt_common import FmtNamespace, TOMLFormatter, run class PyProjectFmtNamespace(FmtNamespace): @@ -16,7 +15,6 @@ class PyProjectFmtNamespace(FmtNamespace): class PyProjectFormatter(TOMLFormatter[PyProjectFmtNamespace]): - def __init__(self) -> None: super().__init__(PyProjectFmtNamespace()) @@ -65,8 +63,10 @@ def format(self, content: str, opt: PyProjectFmtNamespace) -> str: ) return format_toml(content, settings) + def runner(args: Sequence[str] | None = None) -> int: return run(PyProjectFormatter(), args) + if __name__ == "__main__": raise SystemExit(runner())