betty.serde.format package¶
Submodules¶
Module contents¶
Provide serialization formats.
- betty.serde.format.FORMAT_REPOSITORY = <betty.serde.format.FormatRepository object>¶
The (de)serialization format plugin repository.
Read more about Serialization format plugins.
- class betty.serde.format.Format[source]¶
Bases:
PluginDefines a (de)serialization format.
- abstractmethod classmethod extensions() set[str][source]¶
The file extensions this format can (de)serialize.
- abstractmethod load(dump: str) Dump[source]¶
Deserialize data.
- Raises:
FormatError – Raised when the dump could not be loaded.
- exception betty.serde.format.FormatError[source]¶
Bases:
AssertionFailedRaised when data that is being deserialized is provided in an unknown (undeserializable) format.
- final class betty.serde.format.FormatRepository[source]¶
Bases:
PluginRepository[Format]Exposes the available (de)serialization formats.
- async extensions() set[str][source]¶
All file extensions supported by the formats in this repository.
- async get(plugin_id: MachineName) type[Format][source]¶
Get a single plugin by its ID.
- Raises:
PluginNotFound – if no plugin can be found for the given ID.
- final class betty.serde.format.FormatStr[source]¶
Bases:
LocalizableLocalize and format a sequence of (de)serialization formats.
- localize(localizer: Localizer) LocalizedStr[source]¶
Localize
selfto a human-readable string.