diff options
author | zdc <zdc@users.noreply.github.com> | 2022-03-26 15:41:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 15:41:59 +0200 |
commit | aa60d48c2711cdcd9f88a4e5c77379adb0408231 (patch) | |
tree | 349631a02467dae0158f6f663cc8aa8537974a97 /cloudinit/safeyaml.py | |
parent | 5c4b3943343a85fbe517e5ec1fc670b3a8566b4b (diff) | |
parent | 31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba (diff) | |
download | vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.tar.gz vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.zip |
Merge pull request #51 from zdc/T2117-sagitta-22.1
T2117: Cloud-init updated to 22.1
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 d6f5f95b..ba0e88c8 100644 --- a/cloudinit/safeyaml.py +++ b/cloudinit/safeyaml.py @@ -15,8 +15,9 @@ class _CustomSafeLoader(yaml.SafeLoader): _CustomSafeLoader.add_constructor( - u'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 |