tox-toml-fmt 1.0.0__pp38-pypy38_pp73-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tox-toml-fmt might be problematic. Click here for more details.
- tox_toml_fmt/__init__.py +9 -0
- tox_toml_fmt/__main__.py +82 -0
- tox_toml_fmt/_lib.pyi +13 -0
- tox_toml_fmt/_lib.pypy38-pp73-darwin.so +0 -0
- tox_toml_fmt/py.typed +0 -0
- tox_toml_fmt-1.0.0.dist-info/METADATA +35 -0
- tox_toml_fmt-1.0.0.dist-info/RECORD +10 -0
- tox_toml_fmt-1.0.0.dist-info/WHEEL +4 -0
- tox_toml_fmt-1.0.0.dist-info/entry_points.txt +2 -0
- tox_toml_fmt-1.0.0.dist-info/licenses/LICENSE.txt +18 -0
tox_toml_fmt/__init__.py
ADDED
tox_toml_fmt/__main__.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""Main entry point for the formatter."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Sequence
|
|
6
|
+
|
|
7
|
+
from toml_fmt_common import ArgumentGroup, FmtNamespace, TOMLFormatter, _build_cli, run # noqa: PLC2701
|
|
8
|
+
|
|
9
|
+
from ._lib import Settings, format_toml
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from argparse import ArgumentParser
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class PyProjectFmtNamespace(FmtNamespace):
|
|
16
|
+
"""Formatting arguments."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ToxTOMLFormatter(TOMLFormatter[PyProjectFmtNamespace]):
|
|
20
|
+
"""Format pyproject.toml."""
|
|
21
|
+
|
|
22
|
+
def __init__(self) -> None:
|
|
23
|
+
"""Create a formatter."""
|
|
24
|
+
super().__init__(PyProjectFmtNamespace())
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def prog(self) -> str:
|
|
28
|
+
""":return: program name"""
|
|
29
|
+
return "tox-toml-fmt"
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def filename(self) -> str:
|
|
33
|
+
""":return: filename operating on"""
|
|
34
|
+
return "pyproject.toml"
|
|
35
|
+
|
|
36
|
+
def add_format_flags(self, parser: ArgumentGroup) -> None:
|
|
37
|
+
"""
|
|
38
|
+
Additional formatter config.
|
|
39
|
+
|
|
40
|
+
:param parser: parser to operate on.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def override_cli_from_section(self) -> tuple[str, ...]:
|
|
45
|
+
""":return: path where config overrides live"""
|
|
46
|
+
return ("tox-toml-fmt",)
|
|
47
|
+
|
|
48
|
+
def format(self, text: str, opt: PyProjectFmtNamespace) -> str: # noqa: PLR6301
|
|
49
|
+
"""
|
|
50
|
+
Perform the formatting.
|
|
51
|
+
|
|
52
|
+
:param text: content to operate on
|
|
53
|
+
:param opt: formatter config
|
|
54
|
+
:return: formatted text
|
|
55
|
+
"""
|
|
56
|
+
settings = Settings(
|
|
57
|
+
column_width=opt.column_width,
|
|
58
|
+
indent=opt.indent,
|
|
59
|
+
)
|
|
60
|
+
return format_toml(text, settings)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def runner(args: Sequence[str] | None = None) -> int:
|
|
64
|
+
"""
|
|
65
|
+
Run the formatter.
|
|
66
|
+
|
|
67
|
+
:param args: CLI arguments
|
|
68
|
+
:return: exit code
|
|
69
|
+
"""
|
|
70
|
+
return run(ToxTOMLFormatter(), args)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _build_our_cli() -> ArgumentParser:
|
|
74
|
+
return _build_cli(ToxTOMLFormatter())[0] # pragma: no cover
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
__all__ = [
|
|
78
|
+
"runner",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
raise SystemExit(runner())
|
tox_toml_fmt/_lib.pyi
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class Settings:
|
|
2
|
+
def __init__(
|
|
3
|
+
self,
|
|
4
|
+
*,
|
|
5
|
+
column_width: int,
|
|
6
|
+
indent: int,
|
|
7
|
+
) -> None: ...
|
|
8
|
+
@property
|
|
9
|
+
def column_width(self) -> int: ...
|
|
10
|
+
@property
|
|
11
|
+
def indent(self) -> int: ...
|
|
12
|
+
|
|
13
|
+
def format_toml(content: str, settings: Settings) -> str: ...
|
|
Binary file
|
tox_toml_fmt/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: tox-toml-fmt
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
5
|
+
Classifier: Operating System :: OS Independent
|
|
6
|
+
Classifier: Programming Language :: Python
|
|
7
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: toml-fmt-common ==1.0.1
|
|
14
|
+
License-File: LICENSE.txt
|
|
15
|
+
Summary: Format your pyproject.toml file
|
|
16
|
+
Keywords: format,pyproject
|
|
17
|
+
Author-email: Bernat Gabor <gaborjbernat@gmail.com>
|
|
18
|
+
License: MIT
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
21
|
+
Project-URL: Bug Tracker, https://github.com/tox-dev/toml-fmt/issues
|
|
22
|
+
Project-URL: Changelog, https://github.com/tox-dev/toml-fmt/blob/main/tox-toml-fmt/CHANGELOG.md
|
|
23
|
+
Project-URL: Documentation, https://github.com/tox-dev/toml-fmt/
|
|
24
|
+
Project-URL: Source Code, https://github.com/tox-dev/toml-fmt
|
|
25
|
+
|
|
26
|
+
# tox-toml-fmt
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/tox-toml-fmt)
|
|
29
|
+
[](https://pypi.org/project/tox-toml-fmt)
|
|
30
|
+
[](https://pypi.org/project/tox-toml-fmt)
|
|
31
|
+
[](https://pepy.tech/project/tox-toml-fmt)
|
|
32
|
+
[](https://opensource.org/licenses/MIT)
|
|
33
|
+
[](https://github.com/tox-dev/toml-fmt/actions/workflows/tox_toml_fmt_build.yaml)
|
|
34
|
+
[](https://github.com/tox-dev/toml-fmt/actions/workflows/tox_toml_fmt_test.yaml)
|
|
35
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
tox_toml_fmt-1.0.0.dist-info/METADATA,sha256=RmFuu17YL5noWiCVqImbdeceeDnLEjlzFx1s55raLZY,2101
|
|
2
|
+
tox_toml_fmt-1.0.0.dist-info/WHEEL,sha256=K-SEdZamQ5DcfDSLGI0wujsyYGA4uI3hnjCxQJpdKkY,109
|
|
3
|
+
tox_toml_fmt-1.0.0.dist-info/entry_points.txt,sha256=Q7OSuY8ukD6r9YC-NIY4ItMvFP3wO9JfnbBPpBIAYKQ,60
|
|
4
|
+
tox_toml_fmt-1.0.0.dist-info/licenses/LICENSE.txt,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
|
|
5
|
+
tox_toml_fmt/__init__.py,sha256=uN5AcmM1UbDzHeAGg8ME3pj5pcsGlv5hMBHfp7kIEnw,134
|
|
6
|
+
tox_toml_fmt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
tox_toml_fmt/__main__.py,sha256=WdVCYeWeq8c-pGNZhjZWsyp2xhCXZSliCS9ZUdk9OLM,1984
|
|
8
|
+
tox_toml_fmt/_lib.pyi,sha256=tAxhDxzq_0GshQupB-q8XrtmE3_d0iz4qUiVOrdNGo4,289
|
|
9
|
+
tox_toml_fmt/_lib.pypy38-pp73-darwin.so,sha256=DL_Z6lEp4CF27t5JgCmgqIbbCOnu5aV_DjIXyXP-YaY,1019424
|
|
10
|
+
tox_toml_fmt-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
2
|
+
copy of this software and associated documentation files (the
|
|
3
|
+
"Software"), to deal in the Software without restriction, including
|
|
4
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
5
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
6
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
7
|
+
the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included
|
|
10
|
+
in all copies or substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
13
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
15
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
16
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
17
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
18
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|