Skip to content

unpacker

Classes:

  • UnpackedValue

    Describes where and how to store a value.

  • UnpackedValueStream

    Describes where and how to store a stream.

  • Unpacker

    A base for classes that decompose storable objects into their constituent parts.

Attributes:

AnyUnpackedValue module-attribute

AnyUnpackedValue = (
    UnpackedValue[Any] | UnpackedValueStream[Any]
)

A type that can be either a value or a stream of values.

UnpackedValue

Bases: Generic[T], TypedDict

Describes where and how to store a value.

Attributes:

serializer instance-attribute

serializer: Serializer[T] | None

The serializer to apply to the value.

storage instance-attribute

storage: Storage | None

The storage to send the serialized value to.

value instance-attribute

value: Required[T]

The value to store.

UnpackedValueStream

Bases: Generic[T], TypedDict

Describes where and how to store a stream.

Attributes:

serializer instance-attribute

serializer: StreamSerializer[T] | None

The serializer to apply to the stream.

storage instance-attribute

storage: Storage | None

The storage to send the serialized stream to.

value_stream instance-attribute

value_stream: Required[AsyncIterable[T]]

The stream of data to store.

Unpacker

Bases: Generic[S, D], Component

A base for classes that decompose storable objects into their constituent parts.

Methods:

  • repack_object

    Reconstitute the object from a mapping of its unpacked contents.

  • unpack_object

    Return a mapping of that describes where and how to store the object's contents.

Attributes:

name class-attribute

The globally unique name of the component.

repack_object abstractmethod

repack_object(
    cls: type[S], contents: D, registry: Registry
) -> S

Reconstitute the object from a mapping of its unpacked contents.

unpack_object abstractmethod

unpack_object(obj: S, registry: Registry) -> D

Return a mapping of that describes where and how to store the object's contents.