Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring fix #10

Merged
merged 10 commits into from
Mar 12, 2024
1 change: 1 addition & 0 deletions {{cookiecutter.project_name}}/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Config files to be used with hydra."""
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TomlSplitListsEncoder(toml.TomlEncoder):
"""Custom encoder to split lists into multiple lines."""

def dump_list(self, v) -> str:
"""Docstring to shut up ruff."""
bourdeet marked this conversation as resolved.
Show resolved Hide resolved
if len(v) == 0:
return "[]"
else:
Expand All @@ -20,6 +21,17 @@ class TomlSplitListsEncoder(toml.TomlEncoder):
return retval

def dump_value(self, v) -> str:
"""Convert an object to a string representation.

In case the object is a string then we ensure that newlines are preserved.

Args:
v:
The object to be dumped.

Returns:
A string representation of the object.
"""
dump = super().dump_value(v)
if isinstance(v, str) and "\\n" in dump:
dump = dump.replace("\\n", "\n")
Expand Down

This file was deleted.

Empty file.
1 change: 1 addition & 0 deletions {{cookiecutter.project_name}}/tests/test_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@


def test_dummy() -> None:
"""Dummy test function."""
assert True