betty.serde.dump module

Provide a serialization API.

class betty.serde.dump.Dumpable[source]

Bases: object

dump()[source]

Dump this instance to a portable format.

Return type:

typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], type[betty.serde.dump.Void]]

class betty.serde.dump.Void[source]

Bases: object

betty.serde.dump.dump_default(dump, key, default_type)[source]

Add a key and value to a dump, if the key does not exist yet.

betty.serde.dump.minimize(dump, voidable=True)[source]

Minimize a configuration dump by removing any Void configurationfrom sequences and mappings.

Parameters:
dump

voidable=True

Return type:

typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], type[betty.serde.dump.Void]]

betty.serde.dump.none_void(value)[source]

Passthrough a value, but convert None to Void.

Parameters:
value

Return type:

typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], type[betty.serde.dump.Void]]

betty.serde.dump.void_none(value)[source]

Passthrough a value, but convert Void to None.

Parameters:
value

Return type:

typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], type[betty.serde.dump.Void]]