mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Generate: improve duplicate key feedback by providing duplicate text, line and column
This commit is contained in:
3
Utils.py
3
Utils.py
@@ -125,7 +125,8 @@ class UniqueKeyLoader(SafeLoader):
|
|||||||
for key_node, value_node in node.value:
|
for key_node, value_node in node.value:
|
||||||
key = self.construct_object(key_node, deep=deep)
|
key = self.construct_object(key_node, deep=deep)
|
||||||
if key in mapping:
|
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)
|
mapping.add(key)
|
||||||
return super().construct_mapping(node, deep)
|
return super().construct_mapping(node, deep)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user