ATLAS Offline Software
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
AtlCoolConsole.AtlCoolConsole Class Reference
Inheritance diagram for AtlCoolConsole.AtlCoolConsole:
Collaboration diagram for AtlCoolConsole.AtlCoolConsole:

Public Member Functions

def __init__ (self, connectString=None)
 
def interact (self)
 
def parseLine (self, line)
 
def createInterpreterCommand (self, command, argumentString)
 
def command_less (self, argumentString)
 
def command_more (self, argumentString)
 
def command_ls (self, argumentString, doCount=False)
 
def command_pwd (self)
 
def command_pws (self)
 
def command_lstags (self, argumentString)
 
def command_filtertags (self, argumentString)
 
def command_listchans (self, argumentString)
 
def command_listinfo (self, argumentString)
 
def command_rmdir (self, argumentString)
 
def command_usetag (self, argumentString)
 
def command_usechan (self, argumentString)
 
def command_cd (self, argumentString)
 
def command_settag (self, argumentString)
 
def command_settginfo (self, argumentString)
 
def command_setchan (self, argumentString)
 
def command_userunlumi (self, argumentString)
 
def command_usetimes (self, argumentString)
 
def command_clonetag (self, argumentString)
 
def command_rmtag (self, argumentString)
 
def command_locktag (self, argumentString)
 
def command_headtag (self, argumentString)
 
def command_tracetags (self, argumentString)
 
def command_setdesc (self, argumentString)
 
def command_help (self, argumentString)
 
def command_exit (self)
 
def command_open (self, argumentString)
 
def push (self, line)
 
def init_history (self, histfile)
 
def save_history (self, histfile)
 

Public Attributes

 connectString
 

Static Public Attributes

dictionary commands
 
string banner = "Welcome to AtlCoolConsole. Type 'help' for instructions."
 

Detailed Description

Definition at line 53 of file AtlCoolConsole.py.

Constructor & Destructor Documentation

◆ __init__()

def AtlCoolConsole.AtlCoolConsole.__init__ (   self,
  connectString = None 
)

Definition at line 89 of file AtlCoolConsole.py.

89  def __init__( self, connectString = None ):
90  HistoryConsole.__init__( self )
91  self.connectString = connectString
92 
93 

Member Function Documentation

◆ command_cd()

def AtlCoolConsole.AtlCoolConsole.command_cd (   self,
  argumentString 
)

Definition at line 278 of file AtlCoolConsole.py.

278  def command_cd( self, argumentString ):
279  if argumentString is None: argumentString ='/'
280  argumentString = argumentString.strip()
281  if argumentString == '': argumentString = '/'
282  cmds=[]
283  cmds.append('this.cd("%s")' % argumentString)
284  return ';'.join( cmds )
285 

◆ command_clonetag()

def AtlCoolConsole.AtlCoolConsole.command_clonetag (   self,
  argumentString 
)

Definition at line 331 of file AtlCoolConsole.py.

331  def command_clonetag(self,argumentString):
332  args=argumentString.split()
333  if len(args)<3:
334  print ('Usage: clonetag <folder> <sourcetag> <desttag>')
335  return ''
336  cmds=[]
337  cmds.append('this.clonetag("%s")' % argumentString)
338  return ';'.join(cmds)
339 
340 

◆ command_exit()

def AtlCoolConsole.AtlCoolConsole.command_exit (   self)

Definition at line 408 of file AtlCoolConsole.py.

408  def command_exit( self ):
409  return 'import sys ; sys.exit(0)'
410 
411 

◆ command_filtertags()

def AtlCoolConsole.AtlCoolConsole.command_filtertags (   self,
  argumentString 
)

Definition at line 226 of file AtlCoolConsole.py.

226  def command_filtertags(self,argumentString):
227  if argumentString is None or argumentString=="": argumentString = '.'
228  argumentString = argumentString.strip()
229  if argumentString is None: argumentString = '.'
230  args = argumentString.split()
231  node=args[0]
232  pattern=""
233  if len(args)>1:
234  pattern=args[1]
235  cmds = []
236  cmds.append('this.lstags("%s",pattern="%s")' % (node,pattern))
237  return ';'.join(cmds)
238 
239 

◆ command_headtag()

def AtlCoolConsole.AtlCoolConsole.command_headtag (   self,
  argumentString 
)

Definition at line 359 of file AtlCoolConsole.py.

359  def command_headtag(self,argumentString):
360  args=argumentString.split()
361  if len(args)<2:
362  print ('Usage: headtag <folder> <tag>')
363  return ''
364  cmds=[]
365  cmds.append('this.headtag("%s")' % argumentString)
366  return ';'.join(cmds)
367 
368 

◆ command_help()

def AtlCoolConsole.AtlCoolConsole.command_help (   self,
  argumentString 
)

Definition at line 389 of file AtlCoolConsole.py.

389  def command_help( self, argumentString ):
390  if argumentString is not None and argumentString != '':
391  # we have a python "help(...)" command most likely
392  # we only want to intercept "help", therefore return the original
393  return 'help ' + argumentString
394  print ('Available commands:')
395  keys = list(self.commands.keys())
396  keys.sort()
397  for key in keys:
398  print (' %(key)-8s : %(value)s' % { 'key' : key,
399  'value' : self.commands[key] })
400  print ("These commands are shortcuts that are forwarded to a CoolTool")
401  print ("instance 'this', referring to the currently connected database.")
402  print ("Since this environment is a fully functional python shell,")
403  print ("'this' can be used like any python object, e.g.:")
404  print (" this.ls( '/' )")
405  return ''
406 
407 

◆ command_less()

def AtlCoolConsole.AtlCoolConsole.command_less (   self,
  argumentString 
)

Definition at line 177 of file AtlCoolConsole.py.

177  def command_less( self, argumentString ):
178  if argumentString is None:
179  raise Exception( "usage: less <folder>" )
180  argumentString = argumentString.strip()
181  nodes = argumentString.split()
182  cmds = []
183  for node in nodes:
184  cmds.append( 'this.less("%s", header=True)' % node )
185  return ';'.join( cmds )
186 

◆ command_listchans()

def AtlCoolConsole.AtlCoolConsole.command_listchans (   self,
  argumentString 
)

Definition at line 240 of file AtlCoolConsole.py.

240  def command_listchans( self, argumentString ):
241  if argumentString is None: argumentString = '.'
242  argumentString = argumentString.strip()
243  if argumentString is None: argumentString = '.'
244  nodes = argumentString.split()
245  cmds = []
246  for node in nodes:
247  cmds.append( 'this.listchans("%s")' % node )
248  return ';'.join( cmds )
249 

◆ command_listinfo()

def AtlCoolConsole.AtlCoolConsole.command_listinfo (   self,
  argumentString 
)

Definition at line 250 of file AtlCoolConsole.py.

250  def command_listinfo( self, argumentString ):
251  if argumentString is None: argumentString = '.'
252  argumentString = argumentString.strip()
253  if argumentString is None: argumentString = '.'
254  nodes = argumentString.split()
255  cmds = []
256  for node in nodes:
257  cmds.append( 'this.listinfo("%s")' % node )
258  return ';'.join( cmds )
259 

◆ command_locktag()

def AtlCoolConsole.AtlCoolConsole.command_locktag (   self,
  argumentString 
)

Definition at line 350 of file AtlCoolConsole.py.

350  def command_locktag(self,argumentString):
351  args=argumentString.split()
352  if len(args)<2:
353  print ('Usage: locktag <folder> <tag> {action=l|p|u|r}')
354  return ''
355  cmds=[]
356  cmds.append('this.locktag("%s")' % argumentString)
357  return ';'.join(cmds)
358 

◆ command_ls()

def AtlCoolConsole.AtlCoolConsole.command_ls (   self,
  argumentString,
  doCount = False 
)

Definition at line 198 of file AtlCoolConsole.py.

198  def command_ls( self, argumentString, doCount=False ):
199  if argumentString is None: argumentString = '.'
200  argumentString = argumentString.strip()
201  if argumentString == '': argumentString = '.'
202  nodes = argumentString.split()
203  cmds = []
204  tof='False'
205  if (doCount): tof='True'
206  for node in nodes:
207  cmds.append( 'this.ls("%s", header=True, doCount=%s)' % (node,tof) )
208  return ';'.join( cmds )
209 

◆ command_lstags()

def AtlCoolConsole.AtlCoolConsole.command_lstags (   self,
  argumentString 
)

Definition at line 216 of file AtlCoolConsole.py.

216  def command_lstags( self, argumentString ):
217  if argumentString is None: argumentString = '.'
218  argumentString = argumentString.strip()
219  if argumentString is None: argumentString = '.'
220  nodes = argumentString.split()
221  cmds = []
222  for node in nodes:
223  cmds.append( 'this.lstags("%s")' % node )
224  return ';'.join( cmds )
225 

◆ command_more()

def AtlCoolConsole.AtlCoolConsole.command_more (   self,
  argumentString 
)

Definition at line 187 of file AtlCoolConsole.py.

187  def command_more( self, argumentString ):
188  if argumentString is None:
189  raise Exception( "usage: more <folder>" )
190  argumentString = argumentString.strip()
191  nodes = argumentString.split()
192  cmds = []
193  for node in nodes:
194  cmds.append( 'this.more("%s", header=True)' % node )
195  return ';'.join( cmds )
196 
197 

◆ command_open()

def AtlCoolConsole.AtlCoolConsole.command_open (   self,
  argumentString 
)

Definition at line 412 of file AtlCoolConsole.py.

412  def command_open( self, argumentString ):
413  log.debug( 'argumentString: ' + argumentString )
414  if ( not argumentString.startswith('"') and
415  not argumentString.startswith("'") ):
416  argumentString = "'" + argumentString + "'"
417  log.debug( 'argumentString: ' + argumentString )
418  return 'this = AtlCoolTool.AtlCoolTool(%s)' % argumentString
419 
420 

◆ command_pwd()

def AtlCoolConsole.AtlCoolConsole.command_pwd (   self)

Definition at line 210 of file AtlCoolConsole.py.

210  def command_pwd(self):
211  return ';'.join(['this.pwd()'])
212 

◆ command_pws()

def AtlCoolConsole.AtlCoolConsole.command_pws (   self)

Definition at line 213 of file AtlCoolConsole.py.

213  def command_pws(self):
214  return ';'.join(['this.pws()'])
215 

◆ command_rmdir()

def AtlCoolConsole.AtlCoolConsole.command_rmdir (   self,
  argumentString 
)

Definition at line 260 of file AtlCoolConsole.py.

260  def command_rmdir(self, argumentString ):
261  argumentString = argumentString.strip()
262  cmds=[]
263  cmds.append('this.rmdir("%s")' % argumentString)
264  return ';'.join( cmds )
265 

◆ command_rmtag()

def AtlCoolConsole.AtlCoolConsole.command_rmtag (   self,
  argumentString 
)

Definition at line 341 of file AtlCoolConsole.py.

341  def command_rmtag(self,argumentString):
342  args=argumentString.split()
343  if len(args)<2:
344  print ('Usage: rmtag <folder> <leaf or parent tag>')
345  return ''
346  cmds=[]
347  cmds.append('this.rmtag("%s")' % argumentString)
348  return ';'.join(cmds)
349 

◆ command_setchan()

def AtlCoolConsole.AtlCoolConsole.command_setchan (   self,
  argumentString 
)

Definition at line 304 of file AtlCoolConsole.py.

304  def command_setchan(self,argumentString):
305  args=argumentString.split()
306  if len(args)<3:
307  print ('Usage: setchan <folder> <chanID> <chanName> {<chanDescr>}')
308  return ''
309  cmds=[]
310  cmds.append('this.setchan("%s")' % argumentString)
311  return ';'.join(cmds)
312 

◆ command_setdesc()

def AtlCoolConsole.AtlCoolConsole.command_setdesc (   self,
  argumentString 
)

Definition at line 379 of file AtlCoolConsole.py.

379  def command_setdesc( self, argumentString ):
380  args=argumentString.split()
381  if len(args)<1:
382  print ('Usage: setdesc <folder> {<newdesc>}')
383  return ''
384  cmds=[]
385  cmds.append('this.setdesc("%s")' % argumentString)
386  return ';'.join(cmds)
387 
388 

◆ command_settag()

def AtlCoolConsole.AtlCoolConsole.command_settag (   self,
  argumentString 
)

Definition at line 286 of file AtlCoolConsole.py.

286  def command_settag(self,argumentString):
287  args=argumentString.split()
288  if len(args)<3:
289  print ('Usage: settag <folder> <foldertag> <parenttag>')
290  return ''
291  cmds=[]
292  cmds.append('this.settag("%s")' % argumentString)
293  return ';'.join(cmds)
294 

◆ command_settginfo()

def AtlCoolConsole.AtlCoolConsole.command_settginfo (   self,
  argumentString 
)

Definition at line 295 of file AtlCoolConsole.py.

295  def command_settginfo(self,argumentString):
296  args=argumentString.split()
297  if len(args)<2:
298  print ('Usage: settginfo <folder> <tag> <description>')
299  return ''
300  cmds=[]
301  cmds.append('this.settginfo("%s")' % argumentString)
302  return ';'.join(cmds)
303 

◆ command_tracetags()

def AtlCoolConsole.AtlCoolConsole.command_tracetags (   self,
  argumentString 
)

Definition at line 369 of file AtlCoolConsole.py.

369  def command_tracetags(self,argumentString):
370  args=argumentString.split()
371  if len(args)<2:
372  print ('Usage: tracetags <folder> <foldertag>')
373  return ''
374  cmds=[]
375  cmds.append('this.tracetags("%s")' % argumentString)
376  return ';'.join(cmds)
377 
378 

◆ command_usechan()

def AtlCoolConsole.AtlCoolConsole.command_usechan (   self,
  argumentString 
)

Definition at line 272 of file AtlCoolConsole.py.

272  def command_usechan(self, argumentString ):
273  argumentString = argumentString.strip()
274  cmds=[]
275  cmds.append('this.usechan("%s")' % argumentString)
276  return ';'.join( cmds )
277 

◆ command_userunlumi()

def AtlCoolConsole.AtlCoolConsole.command_userunlumi (   self,
  argumentString 
)

Definition at line 313 of file AtlCoolConsole.py.

313  def command_userunlumi(self,argumentString):
314  args=argumentString.split()
315  if len(args)!=1 and len(args)<4:
316  print ('Usage: userunlumi <run1> {<LB1> <run2> <LB2>}')
317  return ''
318  cmds=[]
319  cmds.append('this.userunlumi("%s")' % argumentString)
320  return ';'.join(cmds)
321 

◆ command_usetag()

def AtlCoolConsole.AtlCoolConsole.command_usetag (   self,
  argumentString 
)

Definition at line 266 of file AtlCoolConsole.py.

266  def command_usetag(self, argumentString ):
267  argumentString = argumentString.strip()
268  cmds=[]
269  cmds.append('this.usetag("%s")' % argumentString)
270  return ';'.join( cmds )
271 

◆ command_usetimes()

def AtlCoolConsole.AtlCoolConsole.command_usetimes (   self,
  argumentString 
)

Definition at line 322 of file AtlCoolConsole.py.

322  def command_usetimes(self,argumentString):
323  args=argumentString.split()
324  if len(args)<2:
325  print ('Usage: usetimes <time1> <time2>')
326  return ''
327  cmds=[]
328  cmds.append('this.usetimes("%s")' % argumentString)
329  return ';'.join(cmds)
330 

◆ createInterpreterCommand()

def AtlCoolConsole.AtlCoolConsole.createInterpreterCommand (   self,
  command,
  argumentString 
)

Definition at line 114 of file AtlCoolConsole.py.

114  def createInterpreterCommand( self, command, argumentString ):
115  if command == 'less':
116  return self.command_less( argumentString )
117  elif command == 'more':
118  return self.command_more( argumentString )
119  elif command == 'ls':
120  return self.command_ls( argumentString,False )
121  elif command == 'll':
122  return self.command_ls( argumentString,True )
123  elif command == 'help':
124  return self.command_help( argumentString )
125  elif command == 'exit':
126  return self.command_exit()
127  elif command == 'quit':
128  return self.command_exit()
129  elif command == 'open':
130  return self.command_open( argumentString )
131  elif command =='listtags':
132  return self.command_lstags( argumentString )
133  elif command =='filtertags':
134  return self.command_filtertags( argumentString )
135  elif command =='listchans':
136  return self.command_listchans( argumentString )
137  elif command =='listinfo':
138  return self.command_listinfo( argumentString )
139  elif command =='rmdir':
140  return self.command_rmdir( argumentString )
141  elif command =='usetag':
142  return self.command_usetag( argumentString )
143  elif command =='usechan':
144  return self.command_usechan( argumentString )
145  elif command =='settag':
146  return self.command_settag( argumentString )
147  elif command =='settginfo':
148  return self.command_settginfo( argumentString )
149  elif command =='setchan':
150  return self.command_setchan( argumentString )
151  elif command =='userunlumi':
152  return self.command_userunlumi( argumentString )
153  elif command =='usetimes':
154  return self.command_usetimes( argumentString )
155  elif command =='clonetag':
156  return self.command_clonetag( argumentString )
157  elif command =='rmtag':
158  return self.command_rmtag( argumentString )
159  elif command =='locktag':
160  return self.command_locktag( argumentString )
161  elif command =='headtag':
162  return self.command_headtag( argumentString )
163  elif command =='tracetags':
164  return self.command_tracetags( argumentString )
165  elif command == 'setdesc':
166  return self.command_setdesc( argumentString )
167  elif command =='cd':
168  return self.command_cd( argumentString )
169  elif command =='pwd':
170  return self.command_pwd()
171  elif command =='pws':
172  return self.command_pws()
173  else:
174  return None
175 
176 

◆ init_history()

def AtlCoolConsole.HistoryConsole.init_history (   self,
  histfile 
)
inherited

Definition at line 38 of file AtlCoolConsole.py.

38  def init_history( self, histfile ):
39  readline.parse_and_bind( "tab: complete" )
40  readline.set_history_length( 100 )
41  if hasattr( readline, "read_history_file" ):
42  try:
43  readline.read_history_file( histfile )
44  except IOError:
45  pass
46  atexit.register( self.save_history, histfile )
47 

◆ interact()

def AtlCoolConsole.AtlCoolConsole.interact (   self)

Definition at line 94 of file AtlCoolConsole.py.

94  def interact( self ):
95  self.push( 'from CoolConvUtilities import AtlCoolTool' )
96  if connectString is not None:
97  self.push( 'this = AtlCoolTool.AtlCoolTool("%s")' % self.connectString )
98  self.push( 'print (this)' )
99  else:
100  print ( "Not connected. Use the 'open' command to connect to "
101  "a database." )
102  HistoryConsole.interact( self, self.banner )
103 
104 

◆ parseLine()

def AtlCoolConsole.AtlCoolConsole.parseLine (   self,
  line 
)

Definition at line 105 of file AtlCoolConsole.py.

105  def parseLine( self, line ):
106  for command in self.commands.keys():
107  #res = re.search( '^' + command + '\s*(?P<remainder>.*)', line )
108  res=re.search( '^' + command + r'($|\s+(?P<remainder>.*))', line )
109  if res is not None:
110  return command, res.group('remainder') or ""
111  return None, line
112 
113 

◆ push()

def AtlCoolConsole.AtlCoolConsole.push (   self,
  line 
)

Definition at line 421 of file AtlCoolConsole.py.

421  def push(self, line):
422  command, remainder = self.parseLine( line )
423  log.debug( 'command: %s' % command )
424  log.debug( 'remainder: %s' % remainder )
425 
426  res = self.createInterpreterCommand( command, remainder )
427  if res is not None:
428  log.debug( 'command: "%s"' % res )
429  interpreterCommand = res
430  else:
431  interpreterCommand = line
432 
433  #HistoryConsole.push( self, 'print "cmd: %s"' % interpreterCommand )
434  return HistoryConsole.push( self, interpreterCommand )
435 
436 
437 
438 

◆ save_history()

def AtlCoolConsole.HistoryConsole.save_history (   self,
  histfile 
)
inherited

Definition at line 48 of file AtlCoolConsole.py.

48  def save_history( self, histfile ):
49  readline.write_history_file( histfile )
50 
51 
52 

Member Data Documentation

◆ banner

string AtlCoolConsole.AtlCoolConsole.banner = "Welcome to AtlCoolConsole. Type 'help' for instructions."
static

Definition at line 87 of file AtlCoolConsole.py.

◆ commands

dictionary AtlCoolConsole.AtlCoolConsole.commands
static

Definition at line 55 of file AtlCoolConsole.py.

◆ connectString

AtlCoolConsole.AtlCoolConsole.connectString

Definition at line 91 of file AtlCoolConsole.py.


The documentation for this class was generated from the following file:
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801