betty.portable package#

Submodules#

Module contents#

The portable data API.

Portable data can easily be persistent or transmitted across and between systems.

class betty.portable.KeyedPorter#

Bases: Porter, Generic

An object capable of dumping and loading data to and from portable data and a paired primary key.

abstractmethod dump_keyed(data: DataT, /) tuple[str, PortableData]#

Dump the data to portable data and a portable primary key.

Raises:

betty.portable.error.NotPortable – Raised if any part of the data is not portable.

abstractmethod load_keyed(key: str, data: PortableData, /) DataT#

Create a new data instance from portable data and a portable primary key.

Raises:

betty.exception.HumanFacingException – Raised if the portable data is invalid.

class betty.portable.Porter#

Bases: ABC, Generic

An object capable of dumping and loading data to and from portable data.

abstractmethod dump(data: DataT, /) PortableData#

Dump data to its portable form.

abstractmethod load(data: PortableData, /) DataT#

Load data from its portable form.