MCPcopy Create free account
hub / github.com/aws/aws-cli / ordered_yaml_dump

Function ordered_yaml_dump

awscli/customizations/eks/ordered_yaml.py:41–60  ·  view source on GitHub ↗

Dump an OrderedDict object to yaml. :param to_dump: The OrderedDict to dump :type to_dump: OrderedDict :param stream: The file to dump to If not given or if None, only return the value :type stream: file

(to_dump, stream=None)

Source from the content-addressed store, hash-verified

39
40
41def ordered_yaml_dump(to_dump, stream=None):
42 """
43 Dump an OrderedDict object to yaml.
44
45 :param to_dump: The OrderedDict to dump
46 :type to_dump: OrderedDict
47
48 :param stream: The file to dump to
49 If not given or if None, only return the value
50 :type stream: file
51 """
52 yaml = ruamel.yaml.YAML(typ="safe", pure=True)
53 yaml.default_flow_style = False
54 yaml.width = float('inf')
55 yaml.Representer.add_representer(OrderedDict, _ordered_representer)
56
57 if stream is None:
58 return dump_yaml_to_str(yaml, to_dump)
59
60 yaml.dump(to_dump, stream)

Callers 3

_display_entriesMethod · 0.90
dump_contentMethod · 0.90
write_kubeconfigMethod · 0.90

Calls 2

dump_yaml_to_strFunction · 0.90
dumpMethod · 0.45

Tested by

no test coverage detected