ConsoleUser
Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com
This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.
All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.
- class MarkovBrain.MarkovBrain(user)¶
This <no title> works using Markov transition matricies for both the transition from application to application, but also for those actions performed within an application. In the same directory as the config file pointed to by path should be the files defining those transition matricies. The application matrix is in modules.conf and then each application has its own called <application>Actions.conf.
There is some opportunity for outside influences to alter the state without using the matrix state change, but generally speaking the user will simply continue bouncing around the matrix until told to stop.
Parameters:
user: the <no title> object this brain controls
- get_remote_funcs()¶
This function should be overridden by every subclass that wants to export additional functions that can be accessed remotely.
Each exported function should support the function signature func( outputFileObject, *args ) (obviously “self” is allowed as a first arg for any method). All output the function wants to send to the caller should be written to the outputFileObject, and any expected args will be passed in via the *args. The docstring will be exposed on a request for “help” from the remote caller–unless one of the exported functions overrides the “help” name–so those should provide information about both what the function does and how to use it.
Return: a dictionary of exported function name to the function itself
- main(times=None)¶
This is the main loop for the brain. It will loop either a certain number of times through, or will continually loop until the brain’s stop method is called.
Parameters:
times: instead of looping indefinitely only loop this many times
- next_action()¶
Get the next action that is to be used and advance the state to that action.
Return: the action to use
- next_module()¶
Get the next module that is to be used and advance the state to that module.
Return: the module to use
- valid_transition(mod, action=None, args=None)¶
Check whether a given transition would be valid for this brain/user
Parameters:
mod: the destination module
action: the destination action
args: a tuple of the arguments to that action