ATLAS Offline Software
Classes | Functions | Variables
python.Interactive Namespace Reference

Classes

class  ShellEscapes
 LazyPython based hook for shell commands ====================================. More...
 

Functions

def configureInteractivePrompt (completionDict=None)
 

Variables

list _shellCommands = [ 'echo', 'emacs', 'env', 'ls', 'less', 'more', 'pico', 'vi' ]
 
list _unacceptable = [ 'false', 'true', 'sys' ]
 
string _NAME = 'name'
 
 _NAMEREX = re.compile( r"named? '?(?P<%s>[\w\d]+)'?" % _NAME )
 

Function Documentation

◆ configureInteractivePrompt()

def python.Interactive.configureInteractivePrompt (   completionDict = None)
Configure interactive prompt. The optional completionDict is used to
configure the readline completer.

Definition at line 78 of file Interactive.py.

78 def configureInteractivePrompt(completionDict = None):
79  """Configure interactive prompt. The optional completionDict is used to
80  configure the readline completer."""
81 
82  # Athena-specific command history
83  import atexit
84  import readline
85  import rlcompleter # noqa: F401 (needed for completion)
86 
87  fhistory = os.path.expanduser( '~/.athena.history' )
88 
89  if completionDict is not None:
90  readline.set_completer(rlcompleter.Completer(completionDict).complete)
91 
92  readline.parse_and_bind( 'tab: complete' )
93  readline.parse_and_bind( 'set show-all-if-ambiguous On' )
94 
95  if os.path.exists( fhistory ):
96  readline.read_history_file( fhistory )
97 
98  readline.set_history_length( 1024 )
99 
100  # save history on exit
101  atexit.register( readline.write_history_file, fhistory )
102 
103  # enable shell commands in interactive prompt
104  sys.excepthook = ShellEscapes()

Variable Documentation

◆ _NAME

string python.Interactive._NAME = 'name'
private

Definition at line 13 of file Interactive.py.

◆ _NAMEREX

python.Interactive._NAMEREX = re.compile( r"named? '?(?P<%s>[\w\d]+)'?" % _NAME )
private

Definition at line 14 of file Interactive.py.

◆ _shellCommands

list python.Interactive._shellCommands = [ 'echo', 'emacs', 'env', 'ls', 'less', 'more', 'pico', 'vi' ]
private

Definition at line 11 of file Interactive.py.

◆ _unacceptable

list python.Interactive._unacceptable = [ 'false', 'true', 'sys' ]
private

Definition at line 12 of file Interactive.py.

python.Interactive.configureInteractivePrompt
def configureInteractivePrompt(completionDict=None)
Definition: Interactive.py:78