Skip to main content

Friendly state machines for python.

Project description

https://travis-ci.org/harlowja/automaton.png?branch=master

Friendly state machines for python.

Examples

Squirrel:

>>> from automaton import machines
>>> f = machines.FiniteMachine("sits")
>>> f.add_state("sits")
>>> f.add_state("barks")
>>> f.add_state("wags tail")
>>> f.add_transition("sits", "barks", "squirrel!")
>>> f.add_transition("barks", "wags tail", "gets petted")
>>> f.add_transition("wags tail", "sits", "gets petted")
>>> f.add_transition("wags tail", "barks", "squirrel!")
>>> print(f.pformat())
+-----------+-------------+-----------+----------+---------+
|   Start   |    Event    |    End    | On Enter | On Exit |
+-----------+-------------+-----------+----------+---------+
|   barks   | gets petted | wags tail |    .     |    .    |
|  sits[^]  |  squirrel!  |   barks   |    .     |    .    |
| wags tail | gets petted |    sits   |    .     |    .    |
| wags tail |  squirrel!  |   barks   |    .     |    .    |
+-----------+-------------+-----------+----------+---------+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

automaton-0.1.tar.gz (14.9 kB view hashes)

Uploaded Source

Built Distribution

automaton-0.1-py2.py3-none-any.whl (12.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page