Skip to content

Instantly share code, notes, and snippets.

@harlowja
Created July 31, 2014 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harlowja/f4e3909928b741285992 to your computer and use it in GitHub Desktop.
Save harlowja/f4e3909928b741285992 to your computer and use it in GitHub Desktop.
nested_test.py
from taskflow.types import fsm
import six
a = fsm.FSM("start")
a.add_state('start')
b = fsm.FSM("boop")
b.add_state("boop")
b.add_state("dink")
b.add_transition("boop", "dink", 'bump')
a.add_state("middle", nested_machine=b)
a.add_reaction("middle", "go", lambda *args: "bump")
a.add_transition("start", "middle", "go")
m = a.run_iter('go')
print(six.next(m))
print(six.next(m))
print(six.next(m))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment