Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pairs.append(("__yq_style_{}__".format(hash_key(key)), v_node.style))
elif isinstance(v_node, (yaml.nodes.SequenceNode, yaml.nodes.MappingNode)) and v_node.flow_style is True:
pairs.append(("__yq_style_{}__".format(hash_key(key)), "flow"))
return OrderedDict(pairs)
def parse_unknown_tags(loader, tag_suffix, node):
if isinstance(node, yaml.nodes.ScalarNode):
return loader.construct_scalar(node)
elif isinstance(node, yaml.nodes.SequenceNode):
return construct_sequence(loader, node)
elif isinstance(node, yaml.nodes.MappingNode):
return construct_mapping(loader, node)
OrderedLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, construct_mapping)
OrderedLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_SEQUENCE_TAG, construct_sequence)
OrderedLoader.add_multi_constructor('', parse_unknown_tags)
return OrderedLoader