ActiveVariable

class osaft.core.variable.ActiveVariable(functionCall, name=None)[source]

Bases: BaseActiveVariable

Variables that depended on at least one BaseVariable

Parameters:
  • functionCall (Callable[[], Any]) – function signature that defines how ActiveVariable._value is computed

  • name (Optional[str], optional) – Name of the variable

    Default: None

Public Data Attributes:

value

Returns the value of the attribute.

Inherited from BaseActiveVariable

needs_update

Returns if an update is needed for the next value retrieval

Inherited from BaseVariable

name

Returns name of the variable.

value

Value of the attribute

Public Methods:

Inherited from BaseActiveVariable

is_computed_by(*variables)

Adds the notification dependencies

Inherited from BaseVariable

notify()

Notifies all items in BaseVariable._variables_to_notify that 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_notify that 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_update is true, it calls ActiveVariable._update() first and then changes ActiveVariable._needs_update to False before returning the value.