Friendly state machines for python.
Project description
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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for automaton-0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcad65d28253fe912a0a40fffdec439f9358fcdb602d417042dcb1f7b0eb0337 |
|
MD5 | 89f83147e794a6a3c1a6e27de666a147 |
|
BLAKE2b-256 | 7479ac7d8ee9c1ba0f0a27afb9318b1a719e89d1a4e8dd377a5e03a34db55ade |