Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 809 Bytes

toml_codec.rst

File metadata and controls

39 lines (23 loc) · 809 Bytes

TOML Codec

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

The TOML codec uses the :pytoml module.

odin.codecs.toml_codec

Methods

load

loads

dump

dumps

Customising Encoding

Serialisation of Odin resources is handled by a customised :pytoml.Encoder. Additional data types can be appended to the :pyodin.codecs.toml_codec.TOML_TYPES dictionary.

Example usage

Loading a resource from a file:

from odin.codecs import toml_codec

with open('my_resource.toml') as f:
    resource = toml_codec.load(f)