Skip to content

Commit

Permalink
update comment (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakuyume authored Mar 26, 2022
1 parent ea4357e commit cd46f06
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ isort_known_first_party = ["fakes", "pysen"]
markers = ["examples"]

[tool.black] # automatically generated by pysen
# pysen ignores and overwrites any modifications
line-length = 88
target-version = ["py37"]

[tool.isort] # automatically generated by pysen
# pysen ignores and overwrites any modifications
default_section = "THIRDPARTY"
ensure_newline_before_comments = true
force_grid_wrap = 0
Expand All @@ -35,4 +37,3 @@ known_first_party = ["fakes", "pysen"]
line_length = 88
multi_line_output = 3
use_parentheses = true

6 changes: 5 additions & 1 deletion pysen/dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def dump_toml(path: pathlib.Path, setting: SettingFile) -> None:
for p, d in sorted(entry):
updated = SettingFile.update_by_entry(document, p, d)
if isinstance(updated, tomlkit.items.Table):
updated.comment("automatically generated by pysen")
updated.comment(
"# automatically generated by pysen\n"
"# pysen ignores and overwrites any modifications"
)

with path.open("w") as f:
buf = tomlkit.dumps(document)
Expand Down Expand Up @@ -58,6 +61,7 @@ def dump_cfg(path: pathlib.Path, setting: SettingFile) -> None:
for p, d in sorted(flatten.items()):
config[p] = OrderedDict()
config.set(p, "# automatically generated by pysen", None)
config.set(p, "# pysen ignores and overwrites any modifications", None)
config[p].update(
((k, _repr_cfg(v)) for k, v in sorted(d.items())) # type: ignore[misc]
)
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[flake8]
# automatically generated by pysen
# pysen ignores and overwrites any modifications
# e203: black treats : as a binary operator
# e231: black doesn't put a space after ,
# e501: black may exceed the line-length to follow other style rules
Expand All @@ -10,6 +11,7 @@ select = B,B950,C,E,F,W

[mypy]
# automatically generated by pysen
# pysen ignores and overwrites any modifications
check_untyped_defs = True
disallow_any_decorated = False
disallow_any_generics = True
Expand Down
4 changes: 4 additions & 0 deletions tests/test_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def _assert_toml(path: pathlib.Path, expected: SettingFile) -> None:
def test_dump_toml(temp_file: pathlib.Path, test_nested_data: SettingFile) -> None:
dumper.dump_toml(temp_file, test_nested_data)
expected = """[tool.bar] # automatically generated by pysen
# pysen ignores and overwrites any modifications
a = 1.0
b = 12345
c = "yes"
Expand All @@ -83,6 +84,7 @@ def test_dump_toml(temp_file: pathlib.Path, test_nested_data: SettingFile) -> No
d-1-b = true
d-1-c = true
[tool.foo] # automatically generated by pysen
# pysen ignores and overwrites any modifications
fuga = ["A", "B", "c", "d"]
hoge = true
piyo = "description"
Expand All @@ -105,11 +107,13 @@ def test_dump_cfg(temp_file: pathlib.Path, test_data: SettingFile) -> None:
dumper.dump_cfg(temp_file, test_data)
expected = """[bar]
# automatically generated by pysen
# pysen ignores and overwrites any modifications
a = 1.0
b = 12345
c = yes
[foo]
# automatically generated by pysen
# pysen ignores and overwrites any modifications
fuga = A,B,c,d
hoge = True
piyo = description
Expand Down

0 comments on commit cd46f06

Please sign in to comment.