Welcome to stateflow’s documentation!

Examples

Operator example

>>> from stateflow import var, assign
>>> a = var(1)
>>> b = var(2)
>>> a_plus_b = a + b
>>> print(a_plus_b)
3
>>> assign(a, 4)
>>> print(a_plus_b)
6

Function example

>>> from stateflow import var, assign, reactive
>>> a = var(1)
>>> b = var(2)
>>>
>>> @reactive
... def elaborate(a, b):
...     return "{} + {} = {}".format(a, b, a+b)
>>>
>>> text = elaborate(a, b)
>>> print(text)
1 + 2 = 3
>>> assign(a, 4)
>>> print(text)
4 + 2 = 6

Todo:

  • ev
  • exception handling (many examples)
  • reactive_finalizable
  • volatile

API Reference

Contents:

Exceptions definitions.

exception stateflow.errors.ArgEvalError(arg_name, function_name, call_stack, cause)[source]

A reactive argument is in error state. The argument error should be the cause of this error.

exception stateflow.errors.EvalError(definition_stack, cause)[source]

An exception occured while evaluation of some Observable.

exception stateflow.errors.NotAssignable[source]

Raised when the “__assign__” method is called on the Observable that doesn’t support assignment.

exception stateflow.errors.NotInitializedError[source]
exception stateflow.errors.SilentError(cause=None, *args)[source]

An exception that is silently propagated and not raised unless explicit unwrapping is done on the variable. The error that is silenced should be the cause of this error.

exception stateflow.errors.ValidationError(description)[source]

An argument doesn’t satisfy some criterion so the function is not called.

Indices and tables