adorn.alter.dict_alter module
Apply an alteration to an object based off a dict
- class adorn.alter.dict_alter.EnvDictAlter
Bases:
adorn.alter.dict_alter.UserDictAlterInject values from the environment
- Return type
None
- class adorn.alter.dict_alter.UserDictAlter(user_dict)
Bases:
adorn.alter.alter.AlterInject a value from a user provided
dict- Parameters
user_dict (Dict[str, Any]) – dictionary which contains values to be injected
- Return type
None
- a_contains(target_cls, orchestrator, obj)
Check if a value in
user_dicthas been requested- Parameters
target_cls (Type) – the target Type, the given
objwill be converted into or checked againstorchestrator (Orchestrator) – container of all types, typically used to recurse down nested types
obj (Any) – an instance, that will be checked to see if it can be converted into the
target_clsor will be converted to an instance oftarget_cls
- Returns
- if
Truethen a value in the user dict has been requested else
False
- if
- Return type
bool
- a_get(target_cls, orchestrator, obj)
Return this
Alterif the associated with the arguments are requesting it- Parameters
target_cls (Type) – the target Type, the given
objwill be converted into or checked againstorchestrator (Orchestrator) – container of all types, typically used to recurse down nested types
obj (Any) – an instance, that will be checked to see if it can be converted into the
target_clsor will be converted to an instance oftarget_cls
- Returns
- if the provided arguments are contained by this
Alter return it, otherwise
None
- if the provided arguments are contained by this
- Return type
Optional[Alter]
- alter_obj(target_cls, orchestrator, obj)
Swap
objwith a value inuser_dict- Parameters
target_cls (Type) – the target Type, the given
objwill be converted into or checked againstorchestrator (Orchestrator) – container of all types, typically used to recurse down nested types
obj (Any) – an instance, that will be checked to see if it can be converted into the
target_clsor will be converted to an instance oftarget_cls
- Returns
- a value from
user_dictor a TypeCheckErrorproviding a reason why a value fromuser_dictcouldn’t be provided
- a value from
- Return type
Union[Any, TypeCheckError]
- log_instance(target_cls, orchestrator, obj, instance)
Apply logging to an instantiate object
- Parameters
target_cls (Type) – the target Type, the given
objwas converted intoorchestrator (Orchestrator) – container of all types, typically used to recurse down nested types
obj (Any) – an instance, that was converted to an instance of
target_clsinstance (Any) – the output of converting
objinto an instance oftarget_cls
- Returns
nothing is returned, this is a logging event
- Return type
None