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 80 of file Interactive.py.

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