Register#
navground.learning.register
- class Registrable#
Bases:
objectInternal helper class that can be converted to/from a plain dictionary
- _get_dict() → dict[str, Any]#
Sub-classes can override this method to provide fields in
asdict.The default implementation returns an empty dict.
- classmethod _make_from_dict(value: Mapping[str, Any]) → Self#
Sub-classes can override this method to load an instance from a dictionary.
The default implementation initializes the class with no arguments.
- Parameters:
value (Mapping[str, Any]) – The value
- Returns:
An instance initialized from the content of
value.- Return type:
Self
- classmethod from_dict(value: Mapping[str, Any]) → Self#
Load an instance from a dictionary.
Selects a class from field
typeand calls its method_make_from_dict().- Parameters:
value (Mapping[str, Any]) – The value
- Raises:
ValueError – If
typeis not defined or not registered.- Returns:
An instance initialized from the content of
value.- Return type:
Self
- property asdict: dict[str, Any]#
The YAML-able dictionary representation.
Adds the class type name to the dictionary returned by
_get_dict().- Returns:
A YAML-able dictionary