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 Brain.Brain(user)

I am the abstract parent class from which all Brains should derive. If nothing else I can provide stubs for integrating into Controller.py for inheriting classes.

Parameters:

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 “go do stuff” method, every subclass should implement this to suit their own needs.

Parameters:

  • times: instead of looping indefinitely only loop this many times

Brain.get_brain(user)

Create a brain of the appropriate type with the given main config file. The file will be read to find the appropriate type of brain, then that will be compared against the known brain types and hopefully a match will be found. That Brain will then be instantiated using the same config file as its base file.

Parameters:

Return: a suitable instance of Brain, or None if no match can be found