diff options
author | Devaev Maxim <[email protected]> | 2019-06-28 18:59:36 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-06-28 18:59:36 +0300 |
commit | ef3c62a7af520673154233e2d3c89492ffec3195 (patch) | |
tree | 2b78c5918143eff8ef2c89484ac99fc6b7588438 /kvmd/yamlconf/dumper.py | |
parent | ff270591b032cc1f8e342f20a04b84e5dbb31191 (diff) |
f-strings
Diffstat (limited to 'kvmd/yamlconf/dumper.py')
-rw-r--r-- | kvmd/yamlconf/dumper.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/yamlconf/dumper.py b/kvmd/yamlconf/dumper.py index 6dac6baa..b0a561e5 100644 --- a/kvmd/yamlconf/dumper.py +++ b/kvmd/yamlconf/dumper.py @@ -39,7 +39,8 @@ def make_config_dump(config: Section, indent: int=4) -> str: def _inner_make_dump(config: Section, indent: int, _level: int=0) -> Generator[str, None, None]: for (key, value) in sorted(config.items(), key=operator.itemgetter(0)): if isinstance(value, Section): - yield "%s%s:" % (" " * indent * _level, key) + prefix = " " * indent * _level + yield f"{prefix}{key}:" yield from _inner_make_dump(value, indent, _level + 1) yield "" else: @@ -66,7 +67,7 @@ def _make_yaml_kv(key: str, value: Any, indent: int, level: int, comment: str="" prefix = " " * indent * level if commented: prefix = prefix + "# " - text = textwrap.indent("%s:%s" % (key, text), prefix=prefix) + text = textwrap.indent(f"{key}:{text}", prefix=prefix) if comment: lines = text.split("\n") |