Yet another finite state machine with memory.
Project description
# marmoolak
Yet another finite state machine with memory
![alt logo](logo.png)
### 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://appidi.ir/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
Yet another finite state machine with memory
![alt logo](logo.png)
### 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://appidi.ir/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-0.0.9.macosx-10.11-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb2ccc27d83997ae21c3fe0630955fb2c57b48dbea7646c78550ab72fc47320d |
|
MD5 | e6dcc6380a74d77d76473d3ed9f62d9c |
|
BLAKE2b-256 | 18eb77ebff26bc9fb90b60d859606466d94c16d519b7ef035bce84f8b3d06dc6 |
Close
Hashes for marmoolak-0.0.9.macosx-10.6-intel.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fc07495c6f2978746e335fd0709671e13a25778ffcfa78c055556cbc6f54704 |
|
MD5 | 026e7c321c9c254fb9bc47e4c4d32cbe |
|
BLAKE2b-256 | 5975b054f2d20c7bcb41c1f7a87dca85b64a4257994d1e91e6c9f9bc4a395f83 |
Close
Hashes for marmoolak-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 666a1ee8a894510d6672581a5f0d262fee384b2af6c99a71d77a9adfe794f9aa |
|
MD5 | a49cb5739035d99b7e9e51d27ada7684 |
|
BLAKE2b-256 | 2a70ea82a92ad20f30711df6c6a989665d9fdc2ae53c62483f629b339c989d3f |
Close
Hashes for marmoolak-0.0.9-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 431f4884514ffa7b85682afd95564ad18153e820d47b1478032a3554ce0c7b92 |
|
MD5 | 205c60636296050cbf3fa613d9f8576d |
|
BLAKE2b-256 | 43b04bb0e0baf9682a2ddad01717c5701774edc8b010008ab38baf22fd2ba1f8 |