Package prompt :: Module interpreter :: Class Interpreter
[hide private]
[frames] | no frames]

Class Interpreter

source code

Instance Methods [hide private]
 
__init__(self, show_script=True, quit=True, raise_relax_error=False)
The interpreter class.
source code
dict
_setup(self)
Set up all the interpreter objects.
source code
 
off(self, verbose=True)
Turn the function introductions off.
source code
 
on(self, verbose=True)
Turn the function introductions on.
source code
 
populate_self(self)
Place all user functions and other special objects into self.
source code
 
run(self, script_file=None)
Run the python interpreter.
source code
 
script(self, file=None, quit=False)
Function for executing a script file.
source code
Method Details [hide private]

__init__(self, show_script=True, quit=True, raise_relax_error=False)
(Constructor)

source code 

The interpreter class.

Parameters:
  • show_script (bool) - If true, the relax will print the script contents prior to executing the script.
  • quit (bool) - If true, the default, then relax will exit after running the run() method.
  • raise_relax_error (bool) - If false, the default, then relax will print a nice error message to STDERR, without a traceback, when a RelaxError occurs. This is to make things nicer for the user.

_setup(self)

source code 

Set up all the interpreter objects.

All objects are initialised and placed in a dictionary. These will be later placed in different namespaces such as the run() method local namespace.

Returns: dict
The dictionary of interpreter objects.

run(self, script_file=None)

source code 

Run the python interpreter.

The namespace of this function is the namespace seen inside the interpreter. All user accessible functions, classes, etc, should be placed in this namespace.

Parameters:
  • script_file (None or str) - The script file to be executed. For the interpreter mode, this should be left as None.