def multi_constructor(loader, tag_suffix, node):
"""
Deal with !Ref style function format
"""
if tag_suffix not in UNCONVERTED_SUFFIXES:
tag_suffix = "{}{}".format(FN_PREFIX, tag_suffix)
constructor = None
if tag_suffix == "Fn::GetAtt":
constructor = construct_getatt
elif isinstance(node, yaml.ScalarNode):
constructor = loader.construct_scalar
elif isinstance(node, yaml.SequenceNode):
constructor = loader.construct_sequence
elif isinstance(node, yaml.MappingNode):
constructor = loader.construct_mapping
else:
raise "Bad tag: !{}".format(tag_suffix)
return ODict((
(tag_suffix, constructor(node)),
))
评论列表
文章目录