Code Monkey home page Code Monkey logo

marmoolak's Introduction

marmoolak

alt logo
https://codecov.io/github/ourway/marmoolak/coverage.svg?branch=master

install

pip install marmoolak

Usage

import marmoolak
marmoolak.REDIS_HOST = '192.168.99.100'
marmoolak.REDIS_PORT = 6379
machine = marmoolak.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 [email protected]

marmoolak's People

Contributors

ourway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.