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

Module interpreter

source code

The prompt based relax user interface (UI).

Classes [hide private]
  Interpreter
  _Exit
Functions [hide private]
 
exec_script(name, globals)
Execute the script.
source code
 
interact_prompt(self, intro=None, local={})
Replacement function for 'code.InteractiveConsole.interact'.
source code
 
interact_script(self, intro=None, local={}, script_file=None, quit=True, show_script=True, raise_relax_error=False)
Replacement function for 'code.InteractiveConsole.interact'.
source code
 
prompt(intro=None, local=None)
Python interpreter emulation.
source code
 
run_script(intro=None, local=None, script_file=None, quit=True, show_script=True, raise_relax_error=False)
Python interpreter emulation.
source code
 
runcode(self, code)
Replacement code for code.InteractiveInterpreter.runcode.
source code
Variables [hide private]
  status = Status()
  uf_info = Uf_info()
  PS1_ORIG = 'relax> '
  PS2_ORIG = 'relax| '
  PS3_ORIG = '\nrelax> '
  PS1_COLOUR = '\x1b[94mrelax> \x1b[0m'
  PS2_COLOUR = '\x1b[94mrelax| \x1b[0m'
  PS3_COLOUR = '\n\x1b[94mrelax> \x1b[0m'
  __package__ = 'prompt'

Imports: dep_check, ansi, InteractiveConsole, softspace, pi, F_OK, access, chdir, getcwd, path, search, readline, runpy, split, sys, Info_box, Ls, Lh, Ll, system, GPL, _Helper, _Helper_python, Tab_completion, Class_container, Uf_object, AllRelaxErrors, RelaxBinError, RelaxError, RelaxNoneError, RelaxStrError, Status, Uf_info


Function Details [hide private]

interact_prompt(self, intro=None, local={})

source code 

Replacement function for 'code.InteractiveConsole.interact'.

This will enter into the prompt.

Parameters:
  • intro (str) - The string to print prior to jumping to the prompt mode.
  • local (dict) - A namespace which will become that of the prompt (i.e. the namespace visible to the user when in the prompt mode). This should be the output of a function such as locals().

interact_script(self, intro=None, local={}, script_file=None, quit=True, show_script=True, raise_relax_error=False)

source code 

Replacement function for 'code.InteractiveConsole.interact'.

This will execute the script file.

Parameters:
  • intro (str) - The string to print prior to jumping to the prompt mode.
  • local (dict) - A namespace which will become that of the prompt (i.e. the namespace visible to the user when in the prompt mode). This should be the output of a function such as locals().
  • script_file (None or str) - The script file to be executed.
  • quit (bool) - If true, the default, then relax will exit after running the script.
  • show_script (bool) - If true, the relax will print the script contents prior to executing the script.
  • raise_relax_error (bool) - If false, the default, then a nice error message will be sent to STDERR, without a traceback, when a RelaxError occurs. This is to make things nicer for the user.

prompt(intro=None, local=None)

source code 

Python interpreter emulation.

This function replaces 'code.interact'.

Parameters:
  • intro (str) - The string to print prior to jumping to the prompt mode.
  • local (dict) - A namespace which will become that of the prompt (i.e. the namespace visible to the user when in the prompt mode). This should be the output of a function such as locals().

run_script(intro=None, local=None, script_file=None, quit=True, show_script=True, raise_relax_error=False)

source code 

Python interpreter emulation.

This function replaces 'code.interact'.

Parameters:
  • intro (str) - The string to print prior to jumping to the prompt mode.
  • local (dict) - A namespace which will become that of the prompt (i.e. the namespace visible to the user when in the prompt mode). This should be the output of a function such as locals().
  • script_file (None or str) - The script file to be executed.
  • quit (bool) - If true, the default, then relax will exit after running the script.
  • show_script (bool) - If true, the relax will print the script contents prior to executing the script.
  • raise_relax_error (bool) - If false, the default, then a nice error message will be sent to STDERR, without a traceback, when a RelaxError occurs. This is to make things nicer for the user.

runcode(self, code)

source code 

Replacement code for code.InteractiveInterpreter.runcode.

Parameters:
  • code (str) - The code to execute.