diff options
Diffstat (limited to 'cloudinit/safeyaml.py')
-rw-r--r-- | cloudinit/safeyaml.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/cloudinit/safeyaml.py b/cloudinit/safeyaml.py index b95df27d..ba0e88c8 100644 --- a/cloudinit/safeyaml.py +++ b/cloudinit/safeyaml.py @@ -15,8 +15,9 @@ class _CustomSafeLoader(yaml.SafeLoader): _CustomSafeLoader.add_constructor( - 'tag:yaml.org,2002:python/unicode', - _CustomSafeLoader.construct_python_unicode) + "tag:yaml.org,2002:python/unicode", + _CustomSafeLoader.construct_python_unicode, +) class NoAliasSafeDumper(yaml.dumper.SafeDumper): @@ -27,19 +28,21 @@ class NoAliasSafeDumper(yaml.dumper.SafeDumper): def load(blob): - return(yaml.load(blob, Loader=_CustomSafeLoader)) + return yaml.load(blob, Loader=_CustomSafeLoader) def dumps(obj, explicit_start=True, explicit_end=True, noalias=False): """Return data in nicely formatted yaml.""" - return yaml.dump(obj, - line_break="\n", - indent=4, - explicit_start=explicit_start, - explicit_end=explicit_end, - default_flow_style=False, - Dumper=(NoAliasSafeDumper - if noalias else yaml.dumper.Dumper)) + return yaml.dump( + obj, + line_break="\n", + indent=4, + explicit_start=explicit_start, + explicit_end=explicit_end, + default_flow_style=False, + Dumper=(NoAliasSafeDumper if noalias else yaml.dumper.Dumper), + ) + # vi: ts=4 expandtab |