symforce.ops.impl.dataclass_storage_ops module#
- class DataclassStorageOps[source]#
Bases:
object
StorageOps implementation for dataclasses
Supports nested types. If any of the fields are of unknown size (e.g. sequences), the relevant functions expect to be passed an instance instead of the type. However, the length of sequences can be specified using field metadata, allowing for StorageOps functions such as
storage_dim
,from_storage
, andsymbolic
to be passed the dataclass type rather than an instance. Adding a sequence of length 10, for example, would look like:@dataclass class ExampleDataclass: example_list: T.Sequence[ExampleType] = field(metadata={"length": 10})