object_from_dict¶
-
tollan.utils.namespace.
object_from_dict
(d, _namespace_from_dict_op=<function copy>, _namespace_from_dict_schema=None, _namespace_type_key='__class__', _namespace_check_type=None, _namespace_default_type=None, **kwargs)[source]¶ Construct a
Namespace
object from dict.- Parameters
- _namespace_from_dict_opcallable
If set, this is applied to the input dict
d
before thekwargs
get merged to it. Default is “copy”.- _namespace_from_dict_schema
Schema
or None If set, it is used to filter the dict before instantiate the instance.
- _namespace_type_keystr
This is passed to
getobj
to get the type of the object to be constructed.NamespaceNotFoundError
is raised if no valid namespace type is found.- _namespace_check_typecallable or None
If set, it is evaluated with the found namespace type for validation.
NamespaceTypeError
is raised if the validation fails.- _namespace_default_type
NamespaceMixin
subclass. If set, this is assumed when the namespace type cannot be inferred from
_namespace_type_key
.- **kwargs
Additional keyword arguments that get updated to the dict.