Module helpers¶
- sismic.helpers.log_trace(interpreter)¶
Return a list that will be populated by each value returned by the execute_once method of given interpreter.
- Parameters
interpreter (
Interpreter
) – an Interpreter instance- Return type
List
[MacroStep
]- Returns
a list of MacroStep
- sismic.helpers.run_in_background(interpreter, delay=0.05, callback=None)¶
Run given interpreter in background.
The interpreter is ran until it reaches a final configuration. You can manually stop the thread using the added stop of the returned Thread object. This is for convenience only and should be avoided, because a call to stop puts the interpreter in an empty (and thus final) configuration, without properly leaving the active states.
- Parameters
interpreter (
Interpreter
) – an interpreterdelay (
float
) – delay between each call to execute()callback (
Optional
[Callable
[[List
[MacroStep
]],Any
]]) – a function that accepts the result of execute.
- Return type
- Returns
started thread (instance of threading.Thread)
- Deprecated
since 1.3.0, use runner.AsyncRunner instead.
- sismic.helpers.coverage_from_trace(trace)¶
Given a list of macro steps considered as the trace of a statechart execution, return Counter objects that counts the states that were entered, the states that were exited and the transitions that were processed.
- Parameters
trace (
List
[MacroStep
]) – A list of macro steps- Return type
- Returns
A dict whose keys are “entered states”, “exited states” and “processed transitions”
and whose values are Counter object.