soleil.overrides.overridable#
Classes
When an overridable is assigned as a value to a member variable, soleil overrides will be applied to that member using its |
|
|
Choice supporting convenient string-based CLI override |
|
Loads, from a sub-package, a submodule with an overridable name. |
- class soleil.overrides.overridable.Overridable#
Bases:
ABCWhen an overridable is assigned as a value to a member variable, soleil overrides will be applied to that member using its
set()andget()methods (see_soleil_override()).- abstract get(target: str, frame: frame) Any#
- Parameters:
target – The name of the variable that this overridable is being assigned to.
frame – The frame where the overridable is being assigned.
- class soleil.overrides.overridable.submodule(*args, reqs=None)#
Bases:
OverridableLoads, from a sub-package, a submodule with an overridable name. The sub-package can be explicitly provided or inferred from the target variable name.
For example, the .colors.red package can be loaded using either of
color = submodule('.colors', 'red') color = submodule('red')
As an overridable,
submodulesupports interpreting the override string as a new submodule name. Using$ solex main.solconf color='"green"'
for example, will assign the load value of .color.green to color.
- get(target: str, frame: frame)#
- Parameters:
target – The name of the variable that this overridable is being assigned to.
frame – The frame where the overridable is being assigned.
- class soleil.overrides.overridable.choices(values: Dict[str, Any], default)#
Bases:
OverridableChoice supporting convenient string-based CLI override
# main.solconf a:as_type = choices({'A':'submod1:A', 'B':'symbod2:B'}, 'A') color = choices({'red':[1,0,0], 'green':[0,1,0], 'blue':[0,0,1]}, 'red')
bash:~$ solex ./main a='"B"' color='"green"'
- get(*args, **kwargs)#
- Parameters:
target – The name of the variable that this overridable is being assigned to.
frame – The frame where the overridable is being assigned.