CMS 3D CMS Logo

Functions | Variables
TablePrint Namespace Reference

Functions

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

Variables

 write
 

Function Documentation

◆ PrettyPrintTable()

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

Definition at line 7 of file TablePrint.py.

7 def PrettyPrintTable(Headers,Data,ColWidths,WarningCol=[],border='*'):
8  PrintHLine(ColWidths,border)
9  PrintLine(Headers,ColWidths,False,border)
10  PrintHLine(ColWidths,border)
11  if WarningCol==[]:
12  WarningCol=[False]*len(Data)
13  for [line,Warn] in zip(Data,WarningCol):
14  PrintLine(line,ColWidths,Warn,border)
15  PrintHLine(ColWidths,border)
16 

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

Referenced by PrescaleChecker.main().

◆ PrintHLine()

def TablePrint.PrintHLine (   ColWidths,
  border 
)

Definition at line 17 of file TablePrint.py.

17 def PrintHLine(ColWidths,border):
19  for entry in ColWidths:
20  write(border)
21  for i in range(entry):
22  write(border)
23  write(border)
24  write('\n')
25 

References FastTimerService_cff.range, and write.

Referenced by PrettyPrintTable().

◆ PrintLine()

def TablePrint.PrintLine (   line,
  ColWidths,
  Warn,
  border 
)

Definition at line 26 of file TablePrint.py.

26 def PrintLine(line,ColWidths,Warn,border):
27  assert Warn in [True,False]
28  try:
29  assert len(line)==len(ColWidths)
30  except:
31  print(line)
32  print(ColWidths)
33  raise
34  if Warn:
35  write(bcolors.FAIL)
36  for [width, entry] in zip(ColWidths,line):
37  write(border)
38  try:
39  entry = str(entry)
40  except:
41  print("\n\n\n Weird Data .. Bailing out\n\n")
42  sys.exit(0)
43  for i in range(width):
44  if i==0:
45  write(' ')
46  elif i<len(entry)+1:
47  write(entry[i-1])
48  else:
49  write(' ')
50  write(border)
51  write('\n')
52  write(bcolors.ENDC)

References print(), FastTimerService_cff.range, str, write, and ComparisonHelper.zip().

Referenced by PrettyPrintTable().

Variable Documentation

◆ write

TablePrint.write

Definition at line 5 of file TablePrint.py.

Referenced by PrintHLine(), and PrintLine().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
TablePrint.write
write
Definition: TablePrint.py:5
TablePrint.PrintLine
def PrintLine(line, ColWidths, Warn, border)
Definition: TablePrint.py:26
TablePrint.PrintHLine
def PrintHLine(ColWidths, border)
Definition: TablePrint.py:17
str
#define str(s)
Definition: TestProcessor.cc:51
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
TablePrint.PrettyPrintTable
def PrettyPrintTable(Headers, Data, ColWidths, WarningCol=[], border=' *')
Definition: TablePrint.py:7
ComparisonHelper::zip
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Definition: L1TStage2CaloLayer1.h:41