bridge.data.energon.metadata#
Compatibility helpers for Energon sample and batch metadata.
Module Contents#
Functions#
Return dataclass field names, or an empty set for non-dataclass Energon bases. |
|
Return Sample metadata kwargs accepted by the installed Energon version. |
|
Return Batch metadata kwargs accepted by the installed Energon version. |
API#
- bridge.data.energon.metadata._field_names(dataclass_type: type) set[str]#
Return dataclass field names, or an empty set for non-dataclass Energon bases.
- bridge.data.energon.metadata.sample_metadata_kwargs(
- *,
- key: str,
- restore_key: Any = (),
- subflavors: Any = None,
Return Sample metadata kwargs accepted by the installed Energon version.
Energon 7 removed the singular
__subflavor__field while Energon 6 still requires it. Build the kwargs from the installed base dataclass so callers can construct Bridge sample subclasses under either contract.
- bridge.data.energon.metadata.batch_metadata_kwargs(
- *,
- keys: collections.abc.Sequence[str],
- restore_keys: collections.abc.Sequence[Any] | None = None,
Return Batch metadata kwargs accepted by the installed Energon version.