def __init__(self, name, version, *args, **kw):
        """ Usage: Machine("name", 1.0, *args, **kw)"""
        ''' Redis setup'''
        redis_host = REDIS_HOST or os.getenv('REDIS_HOST') or 'localhost'
        _redis_port = REDIS_PORT or os.getenv('REDIS_PORT') or '6379'
        redis_port = int(_redis_port)
        self.r = redis.StrictRedis(host=redis_host, port=redis_port)


        self.rhname = 'appido_core_fsm_{n}_{v}'.format(n=name, v=version)
        history = self.r.get(self.rhname).decode('utf-8')
        if history:
            args[0]['initial'] = history
        self.name = name
        self.version = version
        super(Machine, self).__init__(*args, **kw)
def __init__ ( self , name , version , * args , ** kw ) : redis_host = REDIS_HOST or os . getenv ( 'REDIS_HOST' ) or 'localhost' _redis_port = REDIS_PORT or os . getenv ( 'REDIS_PORT' ) or '6379' redis_port = int ( _redis_port ) self . r = redis . StrictRedis ( host = redis_host , port = redis_port ) self . rhname = 'appido_core_fsm_{n}_{v}' . format ( n = name , v = version ) history = self . r . get ( self . rhname ) . decode ( 'utf-8' ) if history : args [ 0 ] [ 'initial' ] = history self . name = name self . version = version super ( Machine , self ) . __init__ ( * args , ** kw )
Usage: Machine("name", 1.0, *args, **kw)