Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 869 Bytes

yaml_codec.rst

File metadata and controls

39 lines (23 loc) · 869 Bytes

YAML Codec

Codec for serialising and de-serialising YAML data. Supports both array and objects for mapping into resources or collections of resources.

The YAML codec uses the :pyyaml module and uses the compiled C versions of the library if available.

odin.codecs.yaml_codec

Methods

load

loads

dump

dumps

Customising Encoding

Serialisation of Odin resources is handled by a customised :pyyaml.Dumper. Additional data types can be appended to the :pyodin.codecs.yaml_codec.YAML_TYPES dictionary.

Example usage

Loading a resource from a file:

from odin.codecs import yaml_codec

with open('my_resource.yaml') as f:
    resource = yaml_codec.load(f)