Yet another finite state machine with memory and callbacks.
Project description
install
pip install marmoolak
Usage
from marmoolak import Machine def onpanic(e): print 'panic! ' + e.msg def oncalm(e): print 'thanks to ' + e.msg + ' done by ' + e.args[0] def ongreen(e): print 'green' def onyellow(e): print 'yellow' def onred(e): print 'red' fsm = Machine('myname', 'version1' , {'initial': 'green', 'events': [ {'name': 'warn', 'src': 'green', 'dst': 'yellow'}, {'name': 'panic', 'src': 'yellow', 'dst': 'red'}, {'name': 'panic', 'src': 'green', 'dst': 'red'}, {'name': 'calm', 'src': 'red', 'dst': 'yellow'}, {'name': 'clear', 'src': 'yellow', 'dst': 'green'}], 'callbacks': { 'onpanic': onpanic, 'oncalm': oncalm, 'ongreen': ongreen, 'onyellow': onyellow, 'onred': onred }}) fsm.panic(msg='killer bees', url="http://appido.ir/appido/api/getBooks.json") fsm.calm('bob', msg='sedatives in the honey pots')
credits
I used fysom and redis for achiving this functionality. So most of the credit goes to redis and fysom developers.
Contact me
Feel free to drop me a mail at rodmena@me.com
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for marmoolak-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c68c1ba18ca478fb2bf0de4e0036691db3f9b50a91dc549e68cbfbca5d9ec795 |
|
MD5 | 86c26e8f106632cbae5618aace137679 |
|
BLAKE2b-256 | c422253fc1681a293e77b3db6744e9d683a72d86212cdb58b32b766f71b00f47 |
Close
Hashes for marmoolak-1.0.4-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0198ff1e817f6a1f9c784d2e2eacd5977a90bee46d85e335be54f19b15f11a1f |
|
MD5 | f236bd3eb6dde2a7a75ab1e3e45a958c |
|
BLAKE2b-256 | 4fb6c1e7e2daed91ce332d203d9e43b185aee63c2a79115553869a402d4fd825 |