Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.serde.dump module

Provide a serialization API.

betty.serde.dump.Dump: TypeAlias = bool | int | float | str | None | collections.abc.MutableSequence['Dump'] | collections.abc.MutableMapping[str, 'Dump']

  A serialized dump.

betty.serde.dump.DumpMapping

  A dump which is a mapping whose keys are strings and values are serialized dumps.

  alias of `MutableMapping`[`str`, `_DumpT`]

betty.serde.dump.DumpSequence

  A dump which is a sequence whose values are serialized dumps.

  alias of `MutableSequence`[`_DumpT`]

class betty.serde.dump.Dumpable

  Bases: `ABC`

  Instances can be dumped to serializable data.

  abstract dump() → bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]

    Dump this instance to a portable format.

betty.serde.dump.VoidableDump: TypeAlias = bool | int | float | str | None | collections.abc.MutableSequence['Dump'] | collections.abc.MutableMapping[str, 'Dump'] | type[betty.typing.Void]

  A serialized dump that may be `betty.typing.Void`.

betty.serde.dump.VoidableDumpMapping

  A dump which is a mapping whose keys are strings and values are serialized dumps, or that may be `betty.serde.dump.Void`

  alias of `MutableMapping`[`str`, `_VoidableDumpT`]

betty.serde.dump.VoidableDumpSequence

  A dump which is a sequence whose values are serialized dumps, or that may be `betty.serde.dump.Void`

  alias of `MutableSequence`[`_VoidableDumpT`]

betty.serde.dump.dump_default(dump: MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]], key: str, default_type: type[MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]]]) → MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]]
betty.serde.dump.dump_default(dump: MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]], key: str, default_type: type[MutableSequence[bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]]]) → MutableSequence[bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]]

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

betty.serde.dump.minimize(dump: bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void] | MutableSequence[bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]], voidable: Literal[True] = True) → bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]
betty.serde.dump.minimize(dump: bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void] | MutableSequence[bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]], voidable: Literal[False]) → bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]

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

betty.serde.dump.none_void(value: bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]) → bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]

  Passthrough a value, but convert None to Void.

betty.serde.dump.void_none(value: bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]) → bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]

  Passthrough a value, but convert Void to None.