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 5 of file TablePrint.py.

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

Referenced by PrescaleChecker.main().

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

Definition at line 15 of file TablePrint.py.

References TriggerAnalyzer.write().

Referenced by PrettyPrintTable().

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

Definition at line 24 of file TablePrint.py.

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

Referenced by PrettyPrintTable().

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