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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 2Python 3

File details

Details for the file automaton-0.1.tar.gz.

File metadata

  • Download URL: automaton-0.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for automaton-0.1.tar.gz
Algorithm Hash digest
SHA256 65b4e3cd6b8bf38edfc68cac761de7e0628359e73bf843a6bdcb1dcdd5e17a84
MD5 0d72b4e315228309d9b745ecea781170
BLAKE2b-256 9400d796043dc95e396e610e0586b98a55ba16fdcb6edfaf40e26e3dc3f8d935

See more details on using hashes here.

File details

Details for the file automaton-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for automaton-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bcad65d28253fe912a0a40fffdec439f9358fcdb602d417042dcb1f7b0eb0337
MD5 89f83147e794a6a3c1a6e27de666a147
BLAKE2b-256 7479ac7d8ee9c1ba0f0a27afb9318b1a719e89d1a4e8dd377a5e03a34db55ade

See more details on using hashes here.

Supported by

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