betty.serde.format.formats module - Betty documentation

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

# betty.serde.format.formats module

Provide serialization formats.

final class betty.serde.format.formats.Json

  Bases: `ShorthandPluginBase`, `Format`

  Defines the JSON (de)serialization format.

  dump(dump: Voidable[Dump]) → str

    Serialize data.

  classmethod extensions() → set[str]

    The file extensions this format can (de)serialize.

  load(dump: str) → bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]

    Deserialize data.

    Raises:

      FormatError – Raised when the dump could not be loaded.

final class betty.serde.format.formats.Yaml

  Bases: `ShorthandPluginBase`, `Format`

  Defines the YAML (de)serialization format.

  dump(dump: Voidable[Dump]) → str

    Serialize data.

  classmethod extensions() → set[str]

    The file extensions this format can (de)serialize.

  load(dump: str) → bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]

    Deserialize data.

    Raises:

      FormatError – Raised when the dump could not be loaded.