Skip to content

Commit

Permalink
Update {{cookiecutter.project_name}}/src/scripts/{{'' if cookiecutter…
Browse files Browse the repository at this point in the history
….dependency_manager != 'pip' else 'freeze_dependencies.py'}}

Co-authored-by: Dan Saattrup Nielsen <[email protected]>
  • Loading branch information
bourdeet and saattrupdan authored Mar 7, 2024
1 parent 5dad34c commit 3ab63f4
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ class TomlSplitListsEncoder(toml.TomlEncoder):
return retval

def dump_value(self, v) -> str:
"""Docstring to shut up ruff."""
"""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

0 comments on commit 3ab63f4

Please sign in to comment.