symforce.values.index_entry module¶
- class IndexEntry(offset, storage_dim, stored_datatype, shape=None, item_index=None)[source]¶
 Bases:
objectContains the structural information needed to reconstruct a single value of a
values.Valuesfrom storage in methodvalues.Values.from_storage_index()Meant to be a python parallel to
index_entry_tinsymforce.lcmFor
entry: IndexEntry = v.index()[key]forValues vand stringkey- Parameters:
 offset (int) –
storage_dim (int) –
stored_datatype (dataclasses.InitVar[T.Type]) –
shape (T.Optional[T.Tuple[int, ...]]) –
item_index (T.Optional[T.Dict[str, T.Any]]) –
- offset¶
 The index of
StorageOps.to_storage(v)at whichStorageOps.to_storage(v[key])begins- Type:
 
- shape¶
 If datatype() is np.ndarray or
sf.Matrix, it’s the shape ofv[key]. Otherwise, it’sNone.- Type:
 T.Optional[T.Tuple[int, …]]
- item_index¶
 v[key].index()if datatype() isValues, if datatype() is list or tuple, is dictdwhered[f"{key}_{i}"]equals theIndexEntryofv[key][i], and otherwise is None- Type:
 T.Optional[T.Dict[str, T.Any]]
- stored_datatype: dataclasses.InitVar[T.Type]¶
 
- datatype()[source]¶
 Returns the type indexed by self
Example:
IndexEntry(offset, storage_dim, stored_datatype).datatype()
returns
stored_datatype- Precondition:
 The datatype stored must have had its module loaded (i.e., if the stored datatype is
sf.Rot3,symforce.geomust have been imported). The datatype must also be accessible from the module (dynamically created types do not do this. For example, the sf.Matrix types with more than 10 rows or columns)
- Return type: