From 1b3b0f199d6631550455f4278ff7a9141e506f67 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Tue, 25 Jan 2022 04:20:08 +0100 Subject: [PATCH] Generate: improve duplicate key feedback by providing duplicate text, line and column --- Utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utils.py b/Utils.py index 35a71473..58883da0 100644 --- a/Utils.py +++ b/Utils.py @@ -125,7 +125,8 @@ class UniqueKeyLoader(SafeLoader): for key_node, value_node in node.value: key = self.construct_object(key_node, deep=deep) if key in mapping: - raise KeyError(f"Duplicate key {key!r} found in YAML. Already found keys: {mapping}.") + logging.error(f"YAML duplicates sanity check failed{key_node.start_mark}") + raise KeyError(f"Duplicate key {key} found in YAML. Already found keys: {mapping}.") mapping.add(key) return super().construct_mapping(node, deep)