nanover.utilities.packing module
- class nanover.utilities.packing.PackingPair(*, pack: Callable[[U], P], unpack: Callable[[P], U])
Bases:
Generic[U,P]Pair of functions for packing and unpacking rich data into and from simpler types understood by MessagePack.
- pack: Callable[[U], P]
- unpack: Callable[[P], U]
- nanover.utilities.packing.fallback_encoder(obj: Any) Any
Converts, if possible, a type msgpack doesn’t understand into a basic type it can encode.
- Parameters:
obj – object to be converted
- Returns:
simplified object
- nanover.utilities.packing.make_bytes_packer(dtype: DTypeLike, shape: tuple[int, ...] = (-1,))
- nanover.utilities.packing.pack_array(values: Iterable, *, dtype: DTypeLike) bytes
Serialize an array of numbers into bytes of the given dtype.
- nanover.utilities.packing.unpack_array(buffer: bytes, *, dtype: DTypeLike) ndarray[tuple[Any, ...], dtype[_ScalarT]]
Deserialize an array of numeric data of the given dtype from bytes.