bridge.data.energon.metadata#

Compatibility helpers for Energon sample and batch metadata.

Module Contents#

Functions#

_field_names

Return dataclass field names, or an empty set for non-dataclass Energon bases.

sample_metadata_kwargs

Return Sample metadata kwargs accepted by the installed Energon version.

batch_metadata_kwargs

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,
) dict[str, Any]#

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,
) dict[str, Any]#

Return Batch metadata kwargs accepted by the installed Energon version.