1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-13 22:28:14 +00:00

Merge 495ebd6aab8cb2bdd151a35eec5d23c1c4c28db9 into 0ab63dc4d433aca2f6e0347fa43421bf8e4c1585

This commit is contained in:
Jimmy Hedman 2018-04-10 15:17:50 +00:00 committed by GitHub
commit ab222e1175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,8 +97,16 @@ def _add_reference(obj, loader, node):
return obj
def _include(self, node):
"""Include file"""
filename = self.construct_scalar(node)
with open(filename, 'r') as f:
return yaml.load(f, yaml.SafeLoader)
yaml.SafeLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, _ordered_dict)
yaml.SafeLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_SEQUENCE_TAG, _construct_seq)
yaml.SafeLoader.add_constructor('!include', _include)
# From: https://gist.github.com/miracle2k/3184458