From e2856eddf3fb9a5b8d6260ddf3ab0e273a4d11c3 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Thu, 2 Nov 2023 14:26:52 +0100 Subject: [PATCH] Keep keys missing from source, but move to end of file and print warning --- arb_reformatter.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arb_reformatter.py b/arb_reformatter.py index 3a97c626..5d1a3d35 100755 --- a/arb_reformatter.py +++ b/arb_reformatter.py @@ -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):