baybe.serialization.core.get_base_structure_hook

baybe.serialization.core.get_base_structure_hook(base: type[_T], overrides: dict | None = None)[source]

Return a hook for structuring a dictionary into an appropriate subclass.

Provides the inverse operation to unstructure_base.

Parameters:
  • base (type[TypeVar(_T)]) – The corresponding class

  • overrides (Optional[dict]) – An optional dictionary of cattrs-overrides for certain attributes.

Return type:

Callable[[dict, type[TypeVar(_T)]], TypeVar(_T)]

Returns:

The hook.