CMS 3D CMS Logo

Functions
TableParser Namespace Reference

Functions

def extractPages (configFileFlag=False)
 
def extractPagesForPackage ()
 
def generateTab (items, curr, tabClass='tabs3')
 

Function Documentation

def TableParser.extractPages (   configFileFlag = False)

Definition at line 19 of file TableParser.py.

References mps_alisetup.append, and pileupCalc.upper.

Referenced by generateTab().

19 def extractPages(configFileFlag = False):
20  # initial page, A
21  pages = {'A':[]}
22  # find all class/namespace talbe rows.
23  table = htmlPage.find('table', {'class' : tableClassName})
24  for row in table.findAll('tr'):
25  # please see the related html file (annotated.html) to understand the
26  # approach here. you will see that, only hidden rows have style
27  # attribute and these hidden rows must be added to pages of their
28  # parents. This is why we need to check whether row has a style
29  # attribute or not.
30  styleFlag = False
31  if row.has_key('style'): styleFlag = True
32  # change the first letter if row is not hidden (child) one
33  if not styleFlag: firstLetter = row.findAll('td')[0].text[0].upper()
34  # if pages dict doesn't have the page yet..
35  if not pages.has_key(firstLetter):
36  pages[firstLetter] = []
37  # insert the row into the related page
38  if configFileFlag:
39  url = row.find('a')['href']
40  if '_cff' in url or '_cfi' in url or '_cfg' in url:
41  pages[firstLetter].append(row)
42  else:
43  pages[firstLetter].append(row)
44  return pages
45 
46 # load rows from the package documentation page. output structure:
47 # pages = {'PackageA' : [..], 'PackageB' : [...]}
def extractPages(configFileFlag=False)
Definition: TableParser.py:19
def TableParser.extractPagesForPackage ( )

Definition at line 48 of file TableParser.py.

References mps_alisetup.append, and digi_MixPreMix_cfi.strip.

Referenced by generateTab().

49  # initial page, A
50  pages = {}
51  table = htmlPage.find('table', {'class' : tableClassName})
52  for row in table.findAll('tr'):
53  # first cell contains name of the package...
54  name = row.findAll('td')[0].text
55  # parse package names --please have a look at the pages.html file
56  name = name[name.find(' '):name.find('/')].strip()
57  # if the package is not added yet
58  if not pages.has_key(name): pages[name] = []
59  pages[name].append(row)
60  return pages
61 
62 # generate alphabetic tab for html pages that will be generated by this script
def extractPagesForPackage()
Definition: TableParser.py:48
def TableParser.generateTab (   items,
  curr,
  tabClass = 'tabs3' 
)

Definition at line 63 of file TableParser.py.

References extractPages(), extractPagesForPackage(), and harvestTrackValidationPlots.str.

63 def generateTab(items, curr, tabClass = 'tabs3'):
64  itemTagMap = {}; tab = ''
65  for item in items:
66  fn = fileNameTemplate % item.replace(' ', '_') # generate file name
67  if item != curr: tab += '<li><a href="%s">%s</a></li>' % (fn, item)
68  else: tab += '<li class="current"><a href="%s">%s</a></li>'%(fn, item)
69  return '<div class="%s"><ul class="tablist">%s</ul></div>' % (tabClass,tab)
70 
def generateTab(items, curr, tabClass='tabs3')
Definition: TableParser.py:63