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
load
loads
dump
dumps
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.
Loading a resource from a file:
from odin.codecs import yaml_codec
with open('my_resource.yaml') as f:
resource = yaml_codec.load(f)