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 the default_start_state that your machine may have defined (if your machine has no actively defined default_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.Duplicate[source]

Raised when a duplicate entry is found.

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.

Hierarchy

digraph inheritance348b908e00 { rankdir=LR; size="8.0, 12.0"; "InvalidState" [style="setlinewidth(0.5)",URL="#automaton.exceptions.InvalidState",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25,shape=box,fontsize=10]; "AutomatonException" -> "InvalidState" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NotFound" [style="setlinewidth(0.5)",URL="#automaton.exceptions.NotFound",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25,shape=box,fontsize=10]; "AutomatonException" -> "NotFound" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Duplicate" [style="setlinewidth(0.5)",URL="#automaton.exceptions.Duplicate",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25,shape=box,fontsize=10]; "AutomatonException" -> "Duplicate" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AutomatonException" [style="setlinewidth(0.5)",URL="#automaton.exceptions.AutomatonException",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25,shape=box,fontsize=10]; "FrozenMachine" [style="setlinewidth(0.5)",URL="#automaton.exceptions.FrozenMachine",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25,shape=box,fontsize=10]; "AutomatonException" -> "FrozenMachine" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NotInitialized" [style="setlinewidth(0.5)",URL="#automaton.exceptions.NotInitialized",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",height=0.25,shape=box,fontsize=10]; "AutomatonException" -> "NotInitialized" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Table Of Contents

Previous topic

Features

Next topic

Installation

This Page