CMS 3D CMS Logo

Functions
TablePrint Namespace Reference

Functions

def PrettyPrintTable (Headers, Data, ColWidths, WarningCol=[], border='*')
 
def PrintHLine (ColWidths, border)
 
def PrintLine (line, ColWidths, Warn, border)
 

Function Documentation

def TablePrint.PrettyPrintTable (   Headers,
  Data,
  ColWidths,
  WarningCol = [],
  border = '*' 
)

Definition at line 6 of file TablePrint.py.

References PrintHLine(), PrintLine(), and ComparisonHelper.zip().

Referenced by PrescaleChecker.main().

6 def PrettyPrintTable(Headers,Data,ColWidths,WarningCol=[],border='*'):
7  PrintHLine(ColWidths,border)
8  PrintLine(Headers,ColWidths,False,border)
9  PrintHLine(ColWidths,border)
10  if WarningCol==[]:
11  WarningCol=[False]*len(Data)
12  for [line,Warn] in zip(Data,WarningCol):
13  PrintLine(line,ColWidths,Warn,border)
14  PrintHLine(ColWidths,border)
15 
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def PrintLine(line, ColWidths, Warn, border)
Definition: TablePrint.py:25
def PrettyPrintTable(Headers, Data, ColWidths, WarningCol=[], border='*')
Definition: TablePrint.py:6
def PrintHLine(ColWidths, border)
Definition: TablePrint.py:16
def TablePrint.PrintHLine (   ColWidths,
  border 
)

Definition at line 16 of file TablePrint.py.

References TriggerAnalyzer.write().

Referenced by PrettyPrintTable().

16 def PrintHLine(ColWidths,border): ## writes a horizontal line of the right width
17  #write = sys.stdout.write
18  for entry in ColWidths:
19  write(border)
20  for i in range(entry):
21  write(border)
22  write(border)
23  write('\n')
24 
def write(self, setup)
def PrintHLine(ColWidths, border)
Definition: TablePrint.py:16
def TablePrint.PrintLine (   line,
  ColWidths,
  Warn,
  border 
)

Definition at line 25 of file TablePrint.py.

References edm.print(), str, TriggerAnalyzer.write(), and ComparisonHelper.zip().

Referenced by PrettyPrintTable().

25 def PrintLine(line,ColWidths,Warn,border):
26  assert Warn in [True,False]
27  try:
28  assert len(line)==len(ColWidths)
29  except:
30  print(line)
31  print(ColWidths)
32  raise
33  if Warn:
34  write(bcolors.FAIL)
35  for [width, entry] in zip(ColWidths,line):
36  write(border)
37  try:
38  entry = str(entry)
39  except:
40  print("\n\n\n Weird Data .. Bailing out\n\n")
41  sys.exit(0)
42  for i in range(width):
43  if i==0:
44  write(' ')
45  elif i<len(entry)+1:
46  write(entry[i-1])
47  else:
48  write(' ')
49  write(border)
50  write('\n')
51  write(bcolors.ENDC)
52 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def PrintLine(line, ColWidths, Warn, border)
Definition: TablePrint.py:25
def write(self, setup)
#define str(s)