Load an OrderedDict object from a yaml stream.
(stream)
| 28 | |
| 29 | |
| 30 | def ordered_yaml_load(stream): |
| 31 | """Load an OrderedDict object from a yaml stream.""" |
| 32 | yaml = ruamel.yaml.YAML(typ="safe", pure=True) |
| 33 | yaml.Constructor.add_constructor( |
| 34 | ruamel.yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, |
| 35 | _ordered_constructor, |
| 36 | ) |
| 37 | |
| 38 | return yaml.load(stream) |
| 39 | |
| 40 | |
| 41 | def ordered_yaml_dump(to_dump, stream=None): |