add more edge case handling for yaml unsafe marking

This commit is contained in:
Ryan Petrello
2018-04-19 09:13:56 -04:00
parent 31ea55acb9
commit f8211b0588
2 changed files with 13 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ def safe_dump(x, safe_dict=None):
# equality matches (and consider those branches safe)
for k, v in x.items():
dumper = yaml.SafeDumper
if safe_dict.get(k) != v:
if k not in safe_dict or safe_dict.get(k) != v:
dumper = SafeStringDumper
yamls.append(yaml.dump_all(
[{k: v}],