ActiveVariable
- class osaft.core.variable.ActiveVariable(functionCall, name=None)[source]
Bases:
BaseActiveVariableVariables that depended on at least one
BaseVariable- Parameters:
functionCall (
Callable[[],Any]) – function signature that defines howActiveVariable._valueis computedname (
Optional[str], optional) – Name of the variableDefault:NonePublic Data Attributes:
Returns the value of the attribute.
Inherited from
BaseActiveVariableneeds_updateReturns if an update is needed for the next value retrieval
Inherited from
BaseVariablePublic Methods:
Inherited from
BaseActiveVariableis_computed_by(*variables)Adds the notification dependencies
Inherited from
BaseVariablenotify()Notifies all items in
BaseVariable._variables_to_notifythat a dependent value changed.
- is_computed_by(*variables)
Adds the notification dependencies
- Parameters:
variables (
Any) – variables that are referenced in_update()- Raises:
TypeError if no arguments are passed
- Return type:
None
- notify()
Notifies all items in
BaseVariable._variables_to_notifythat a dependent value changed. Just the information of a changed dependency is passed.- Return type:
None
- property name: str
Returns name of the variable.
- Setter:
sets
_name
- property needs_update: bool
Returns if an update is needed for the next value retrieval
- property value: Any
Returns the value of the attribute. If
ActiveVariable.needs_updateis true, it callsActiveVariable._update()first and then changesActiveVariable._needs_updateto False before returning the value.