Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 18, 2024
1 parent 0c36c6d commit 70908c8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions py-common/src/toml_fmt_common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions py-common/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,7 +19,6 @@ class DumpNamespace(FmtNamespace):


class Dumb(TOMLFormatter[DumpNamespace]):

def __init__(self) -> None:
super().__init__(DumpNamespace())

Expand Down
1 change: 0 additions & 1 deletion pyproject-fmt/src/pyproject_fmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from .__main__ import run


__all__ = [
"run",
]
6 changes: 3 additions & 3 deletions pyproject-fmt/src/pyproject_fmt/__main__.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -16,7 +15,6 @@ class PyProjectFmtNamespace(FmtNamespace):


class PyProjectFormatter(TOMLFormatter[PyProjectFmtNamespace]):

def __init__(self) -> None:
super().__init__(PyProjectFmtNamespace())

Expand Down Expand Up @@ -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())

0 comments on commit 70908c8

Please sign in to comment.