API¶
Machines¶
Runners¶
Converters¶
-
automaton.converters.pydot.
convert
(machine, graph_name, graph_attrs=None, node_attrs_cb=None, edge_attrs_cb=None, add_start_state=True, name_translations=None)[source]¶ Translates the state machine into a pydot graph.
Parameters: - machine (FiniteMachine) – state machine to convert
- graph_name (string) – name of the graph to be created
- graph_attrs (dict) – any initial graph attributes to set (see http://www.graphviz.org/doc/info/attrs.html for what these can be)
- node_attrs_cb (callback) – a callback that takes one argument
state
and is expected to return a dict of node attributes (see http://www.graphviz.org/doc/info/attrs.html for what these can be) - edge_attrs_cb (callback) – a callback that takes three arguments
start_state, event, end_state
and is expected to return a dict of edge attributes (see http://www.graphviz.org/doc/info/attrs.html for what these can be) - add_start_state (bool) – when enabled this creates a private start state
with the name
__start__
that will be a point node that will have a dotted edge to thedefault_start_state
that your machine may have defined (if your machine has no actively defineddefault_start_state
then this does nothing, even if enabled) - name_translations (dict) – a dict that provides alternative
state
string names for each state
Exceptions¶
-
exception
automaton.exceptions.
AutomatonException
[source]¶ Base class for most exceptions emitted from this library.
-
exception
automaton.exceptions.
FrozenMachine
[source]¶ Exception raised when a frozen machine is modified.
-
exception
automaton.exceptions.
InvalidState
[source]¶ Raised when a invalid state transition is attempted while executing.
-
exception
automaton.exceptions.
NotFound
[source]¶ Raised when some entry in some object doesn’t exist.
-
exception
automaton.exceptions.
NotInitialized
[source]¶ Error raised when an action is attempted on a not inited machine.