1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-27 23:52:28 +01:00

More yaml validation (#1568)

* validate keys

* refactor line info
This commit is contained in:
Guillermo Ruffino
2021-02-27 19:21:07 -03:00
committed by GitHub
parent 69d39ef0cd
commit 342d5166a0
2 changed files with 17 additions and 11 deletions

View File

@@ -146,6 +146,9 @@ class ESPHomeLoader(yaml.SafeLoader): # pylint: disable=too-many-ancestors
raise yaml.constructor.ConstructorError(
f'Invalid key "{key}" (not hashable)', key_node.start_mark)
key = make_data_base(str(key))
key.from_node(key_node)
# Check if it is a duplicate key
if key in seen_keys:
raise yaml.constructor.ConstructorError(