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 time is updated according to time.time() - starttime. 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 interpreter
  • delay (float) – delay between each call to execute()
  • callback (Optional[Callable[[List[MacroStep]], Any]]) – a function that accepts the result of execute.
Return type:

Thread

Returns:

started thread (instance of threading.Thread)

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:Mapping[str, Counter]
Returns:A dict whose keys are “entered states”, “exited states” and “processed transitions” and whose values are Counter object.