Keep keys missing from source, but move to end of file and print warning

This commit is contained in:
Emil Lundberg 2023-11-02 14:26:52 +01:00
parent 372747f0dd
commit e2856eddf3
No known key found for this signature in database
GPG Key ID: 0F47E61493A9B8E5

View File

@ -45,6 +45,12 @@ def equalize_key_order(source, target):
target_result[key] = source[key]
else:
target_result[key] = None
for key in target.keys():
if key not in target_result:
print(f"WARNING: Key not present in source; moving to end of file: {key}")
target_result[key] = target[key]
return target_result
elif isinstance(source, list) and isinstance(target, list):