Register#
navground.learning.register
- class Registrable#
Bases:
object
Internal 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.
- classmethod from_dict(value: Mapping[str, Any]) → Self#
Load an instance from a dictionary.
Selects a class from field
type
and calls its method_make_from_dict()
.- Parameters:
- Raises:
ValueError – If
type
is not defined or not registered.- Returns:
An instance initialized from the content of
value
.- Return type:
- 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