CMS 3D CMS Logo

Functions | Variables
MainPageGenerator Namespace Reference

Functions

def bsBugFix ()
 
def costumFormatter (inp)
 
def fillContentTemplate (domains)
 
def generateTree (tree)
 
def generateTreeViewPage (tree, name)
 
def getClasses (classesPagePath)
 
def getFiles (filesPagePath)
 
def getPackages (packagesPagePath)
 
def prepareTemplate ()
 

Variables

 classes
 
 cmsswVersion
 
 contentTmpl
 
 contentTmplOrg
 
 data
 
 dataSrc
 
 file
 
 files
 
 fName
 
 githubBase
 
 htmlFileName
 
 htmlFilePath
 
 htmlFullPath
 
 htmlPage
 
 link
 
 loopLimit
 
 packages
 
 page
 
 successFlag
 
 tree
 
 treeViewTmpl
 

Function Documentation

◆ bsBugFix()

def MainPageGenerator.bsBugFix ( )

Definition at line 125 of file MainPageGenerator.py.

125 def bsBugFix():
126  # this function fixes script tag bug of beautifulsoup (bs). bs is escaping
127  # javascript operators according to the html escape characters, such as
128  # > -> ">". The method to ged rid of this issue is to replace script
129  # tags with their original versions in the string level
130  html = str(htmlPage)
131  for scriptTag in BeautifulSoup(contentTmplOrg).findAll('script'):
132  js = scriptTag.text
133  html = html.replace(str(scriptTag), '<script>%s</script>' % js)
134  return html
135 

References str.

◆ costumFormatter()

def MainPageGenerator.costumFormatter (   inp)

Definition at line 121 of file MainPageGenerator.py.

121 def costumFormatter(inp):
122  if inp.find_parent("script") is None: return EntitySubstitution.substitute_html(inp)
123  else: return inp
124 

◆ fillContentTemplate()

def MainPageGenerator.fillContentTemplate (   domains)

Definition at line 136 of file MainPageGenerator.py.

136 def fillContentTemplate(domains):
137  rows = ''
138  rowTmpl = '<tr id="{0}"><td width="50%">{1}</td><td>{2}</td></tr>'
139  aTmpl = """<tr style="padding:0"><td colspan="2" style="padding:0">
140  <div class="accordion" id="{0}">
141  <iframe width="100%" height="250px" frameborder="0"
142  data-src="iframes/{0}.html"> </iframe>
143  </div></td></tr>"""
144  domainNames = domains.keys()
145  domainNames.sort()
146  for domain in domainNames:
147  persons = domains[domain].keys()
148  persons.sort()
149  cCell = ''
150  for person in persons:
151  email = domains[domain][person]
152  cCell = cCell+'<a href="mailto:{0}">{0}<a/>, '.format(person,email)
153  cCell = cCell.rstrip(', ')
154  escapedDomainName = domain.replace(' ', '')
155  rows = rows + rowTmpl.format(escapedDomainName, domain, cCell)
156  rows = rows + aTmpl.format(escapedDomainName)
157  contentTmpl.find('table').append(BeautifulSoup(rows))
158  # put cmssw version
159  contentTmpl.find('h2', {'id' : 'version'}).append(cmsswVersion)
160  content = htmlPage.find('div', {'class' : 'contents'})
161  content.append(contentTmpl)
162 

References mps_setup.append, and relativeConstraints.keys.

◆ generateTree()

def MainPageGenerator.generateTree (   tree)

Definition at line 163 of file MainPageGenerator.py.

163 def generateTree(tree):
164  if type(tree) == dict and len(tree) == 0: return BeautifulSoup('')
165  # our recursive function to generate domain tree views
166  root = BeautifulSoup('<ul></ul>')
167  names = tree.keys(); names.sort()
168  for name in names:
169  node = BeautifulSoup('<li><div></div></li>')
170  if type(tree[name]) == dict:
171  title = BeautifulSoup('<span class="folder"></span>')
172  title.span.append(name)
173  node.li.append(title)
174  # __git__ and __packageDoc__ are special keys which address links,
175  # github and packade documentation links. please see in the section
176  # that we merge all what we have (under the __main__ block)
177  for i in ['__git__', '__packageDoc__']:
178  if not i in tree[name]: continue
179  link = BeautifulSoup(' <a></a>')
180  link.a['target'] = '_blank'
181  link.a['href'] = tree[name][i]
182  link.a.append('[%s]' % i.replace('_', ''))
183  del tree[name][i]
184  title.span.append(link)
185  if len(tree[name]) == 0:
186  title.span['class'] = 'emptyFolder'
187  else: node.li.div['class'] = 'hitarea expandable-hitarea'
188  node.li.append(generateTree(tree[name]))
189  elif type(tree[name]) == str or type(tree[name]) == unicode:
190  link = BeautifulSoup('<a><span class="file"></span></a>')
191  link.a['target'] = '_blank'
192  link.a['href'] = tree[name]
193  link.a.span.append(name)
194  node.li.append(link)
195  else:
196  node.li.append(name)
197  root.ul.append(node)
198  return root
199 

Referenced by generateTreeViewPage().

◆ generateTreeViewPage()

def MainPageGenerator.generateTreeViewPage (   tree,
  name 
)

Definition at line 200 of file MainPageGenerator.py.

200 def generateTreeViewPage(tree, name):
201  page = BeautifulSoup(treeViewTmpl)
202  treeTag = page.find('ul', {'id' : 'browser'})
203  treeTag.append(generateTree(tree))
204  twikiLink = page.find('a', {'id' : 'twiki'})
205  if name in data['TWIKI_PAGES']:
206  twikiLink['href'] = data['TWIKI_PAGES'][name]
207  else:
208  twikiLink.extract()
209  return page
210 
211 

References generateTree().

◆ getClasses()

def MainPageGenerator.getClasses (   classesPagePath)

Definition at line 99 of file MainPageGenerator.py.

99 def getClasses(classesPagePath):
100  data = {}
101  with open(classesPagePath) as f: page = f.read()
102  page = BeautifulSoup(page)
103  content = page.find('div', {'class' : 'contents'})
104  for cell in content.findAll('td'):
105  aTag = cell.find('a')
106  if not aTag or not aTag.has_key('href'): continue
107  data[aTag.text] = '../' + aTag['href']
108  return data
109 

◆ getFiles()

def MainPageGenerator.getFiles (   filesPagePath)

Definition at line 40 of file MainPageGenerator.py.

40 def getFiles(filesPagePath):
41  data = {}
42  # read and parse files.html to get the file hierarchy
43  with open(filesPagePath) as f: page = f.read()
44  page = BeautifulSoup(page)
45  # please have a look at the files.html page to understand the approach.
46  # in short, we use number of '_' character in the id attr to read the
47  # file hierarchy.
48  table = page.find('table', {'class' : 'directory'})
49  level = 0
50  path = []
51  for row in table.findAll('tr'):
52  # first cell is the cell where the info is stored
53  id = row['id']; cell = row.find('td')
54  text = cell.text; url = '../' + cell.find('a')['href']
55  currentLevel = id.count('_')
56  # if current level is more than old one, push current item
57  if currentLevel > level:
58  path.append(text)
59  # if current level equals to old one, pop anmd push (replace)
60  elif currentLevel == level:
61  path.pop(len(path) - 1)
62  path.append(text)
63  else:
64  # if current level is less than old one, pop all items to blance
65  # the level. 'plus one' in the loop is to replace last item
66  for i in range(level - currentLevel + 1):
67  path.pop(len(path) - 1)
68  path.append(text)
69  level = id.count('_')
70  # skip files which are not interface
71  if not 'interface' in path: continue
72  # no need to have 'interface' node on the tree
73  pathWithoutInterface = copy.copy(path)
74  pathWithoutInterface.remove('interface')
75  # conver the path into tree structure
76  node = data
77  for i in pathWithoutInterface:
78  if not node.has_key(i):
79  node[i] = {}
80  node = node[i]
81  return data
82 

References FastTimerService_cff.range.

◆ getPackages()

def MainPageGenerator.getPackages (   packagesPagePath)

Definition at line 83 of file MainPageGenerator.py.

83 def getPackages(packagesPagePath):
84  data = {}
85  with open(packagesPagePath) as f: page = f.read()
86  page = BeautifulSoup(page)
87  table = page.find('table', {'class' : 'directory'})
88  for row in table.findAll('tr'):
89  cell = row.find('td')
90  url = '../' + cell.find('a')['href']
91  # yeah, it is not that good method to parse a string but it is
92  # simple... please see the pages.html file.
93  pkg = cell.text.replace('Package ', '').split('/')
94  if not data.has_key(pkg[0]): data[pkg[0]] = {}
95  if len(pkg) == 2: data[pkg[0]][pkg[1]] = url
96  else: data[pkg[0]][pkg[0]] = url
97  return data
98 

References submitPVValidationJobs.split().

◆ prepareTemplate()

def MainPageGenerator.prepareTemplate ( )

Definition at line 110 of file MainPageGenerator.py.

110 def prepareTemplate():
111  # please notice the following hard coded tags and class names, you may need
112  # to change them in future if doxygen changes its html output structure
113  header = htmlPage.find('div', {'class' : 'header'})
114  content = htmlPage.find('div', {'class' : 'contents'})
115 
116  for tag in header.findAll():
117  tag.extract()
118  for tag in content.findAll():
119  tag.extract()
120 

Variable Documentation

◆ classes

MainPageGenerator.classes

Definition at line 262 of file MainPageGenerator.py.

◆ cmsswVersion

MainPageGenerator.cmsswVersion

Definition at line 36 of file MainPageGenerator.py.

◆ contentTmpl

MainPageGenerator.contentTmpl

Definition at line 32 of file MainPageGenerator.py.

◆ contentTmplOrg

MainPageGenerator.contentTmplOrg

Definition at line 31 of file MainPageGenerator.py.

◆ data

MainPageGenerator.data

Definition at line 35 of file MainPageGenerator.py.

◆ dataSrc

MainPageGenerator.dataSrc

Definition at line 33 of file MainPageGenerator.py.

◆ file

MainPageGenerator.file

Definition at line 279 of file MainPageGenerator.py.

◆ files

MainPageGenerator.files

Definition at line 256 of file MainPageGenerator.py.

◆ fName

MainPageGenerator.fName

◆ githubBase

MainPageGenerator.githubBase

Definition at line 34 of file MainPageGenerator.py.

◆ htmlFileName

MainPageGenerator.htmlFileName

Definition at line 22 of file MainPageGenerator.py.

◆ htmlFilePath

MainPageGenerator.htmlFilePath

Definition at line 21 of file MainPageGenerator.py.

◆ htmlFullPath

MainPageGenerator.htmlFullPath

Definition at line 20 of file MainPageGenerator.py.

◆ htmlPage

MainPageGenerator.htmlPage

Definition at line 23 of file MainPageGenerator.py.

◆ link

MainPageGenerator.link

Definition at line 271 of file MainPageGenerator.py.

Referenced by sipixelobjects::PixelFEDCabling.addLink(), GEMDigiModule.addLinks(), ME0DigiModel.addLinks(), GEMPadDigiClusterValidation.analyze(), GEMPadDigiValidation.analyze(), GEMStripDigiValidation.analyze(), GEMRecHitValidation.analyze(), L1TStage2uGMT.analyze(), L1TCSCTF.analyze(), CSCHitAssociator.associateCSCHitId(), CSCHitAssociator.associateHitId(), EcalABAnalyzer.beginJob(), DTDataIntegrityUrosOffline.bookHistosROS(), DTDataIntegrityTask.bookHistosROS(), DTReadOutMapping.cacheMap(), l1t::stage2::emtf.convert_GEM_location(), convert_L2toL1_card(), convert_L2toL1_link(), l1t::stage2::emtf.convert_RPC_location(), L1TMuonProducer.convertMuons(), SiPixelFedCablingTree.det2fedMap(), SiPixelFedCablingTree.det2PathMap(), tmtt::MiniHTstage.exec(), tmtt::MuxHToutputs.exec(), DTBlockedROChannelsTest.fillChamberMap(), SiPixelFrameReverter.findLinkInFed(), DTReadOutMapping.geometryToReadOut(), get_towerPhi_fromCardLinkTower(), l1t::MP7BufferDumpToRaw.getBlocks(), getEta_fromL2LinkCardTowerCrystal(), SiPixelROCsStatusAndMappingWrapper.getModToUnpRegionalAsync(), RPCAMCLinkMapHandler.getNewObjects(), RPCDCCLinkMapHandler.getNewObjects(), getPhi_fromL2LinkCardTowerCrystal(), DTDataIntegrityTest.getROS(), l1t::stage2::CaloSetup.getUnpackers(), HLTMuonTrimuonL3Filter.hltFilter(), HLTMuonL3PreFilter.hltFilter(), HLTMuonDimuonL3Filter.hltFilter(), HOTPDigiTwinMux.HOTPDigiTwinMux(), RPCReadOutMappingWithFastSearch.init(), DTHitAssociator.initEvent(), DTReadOutMapping.insertReadOutGeometryLink(), CTPPSPixelDataFormatter.interpretRawData(), PixelDataFormatter.interpretRawData(), CSCSPRecord.LCT(), CSCSPRecord.LCTs(), tmtt::MuxHToutputs.linkID(), tmtt::MiniHTstage.linkIDLoadBalanced(), PixelEndcapLinkMaker.links(), PixelBarrelLinkMaker.links(), omtf.mapEleIndex2CscDet(), SiPixelFedCablingMap::Key.operator<(), operator<<(), l1t::stage2::BMTFPackerInputs.pack(), omtf::CscPacker.pack(), SiPixelFedCablingTree.pathToDetUnit(), SiPixelFedCablingTree.pathToDetUnitHasDetUnit(), DTuROSRawToDigi.process(), DTuROSDigiToRaw.process(), PFAnalysis.processBlocks(), RPCCPPFUnpacker.processCPPF(), RPCTwinMuxRawToDigi.processRPCRecord(), RPCCPPFUnpacker.processRXRecord(), RPCCPPFUnpacker.processTXRecord(), DTDataIntegrityUrosOffline.processuROS(), DTDataIntegrityTask.processuROS(), MuonLinksProducerForHLT.produce(), CSCTFPacker.produce(), HLTMuonL2SelectorForL3IO.produce(), CSCTFUnpacker.produce(), L3MuonCandidateProducer.produce(), HLTScoutingMuonProducer.produce(), L2MuonSeedGeneratorFromL1T.produce(), RPCReadOutMapping.rawDataFrame(), DTReadOutMapping.readOutToGeometry(), LaserSorter.renameAsBackup(), tmtt::MuxHToutputs.sanityCheck(), boost::serialization.save(), CSCCorrelatedLCTDigi.setMPCLink(), SiPixelFedCablingMap.SiPixelFedCablingMap(), SiPixelROCsStatusAndMappingWrapper.SiPixelROCsStatusAndMappingWrapper(), L1TMuonProducer.splitAndConvertMuons(), DTBlockedROChannelsTest.theDDU(), DTDataIntegrityUrosOffline.theDDU(), DTDataIntegrityTask.theDDU(), DTuROSRawToDigi.theDDU(), DTuROSDigiToRaw.theLNK(), DTBlockedROChannelsTest.theROB(), DTuROSRawToDigi.theROB(), DTBlockedROChannelsTest.theROS(), DTDataIntegrityUrosOffline.theROS(), DTDataIntegrityTask.theROS(), DTuROSRawToDigi.theROS(), SiPixelFrameConverter.toRoc(), l1t::stage2::CaloTowerUnpacker.unpack(), omtf::MuonUnpacker.unpack(), CSCSPRecord.unpack(), and PixelDataFormatter.unpackFEDErrors().

◆ loopLimit

MainPageGenerator.loopLimit

Definition at line 236 of file MainPageGenerator.py.

◆ packages

MainPageGenerator.packages

Definition at line 259 of file MainPageGenerator.py.

◆ page

MainPageGenerator.page

Definition at line 300 of file MainPageGenerator.py.

◆ successFlag

MainPageGenerator.successFlag

Definition at line 236 of file MainPageGenerator.py.

◆ tree

MainPageGenerator.tree

◆ treeViewTmpl

MainPageGenerator.treeViewTmpl

Definition at line 38 of file MainPageGenerator.py.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MainPageGenerator.generateTree
def generateTree(tree)
Definition: MainPageGenerator.py:163
BeautifulSoup
Definition: BeautifulSoup.py:1
MainPageGenerator.getFiles
def getFiles(filesPagePath)
Definition: MainPageGenerator.py:40
MainPageGenerator.bsBugFix
def bsBugFix()
Definition: MainPageGenerator.py:125
MainPageGenerator.generateTreeViewPage
def generateTreeViewPage(tree, name)
Definition: MainPageGenerator.py:200
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
MainPageGenerator.getClasses
def getClasses(classesPagePath)
Definition: MainPageGenerator.py:99
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
str
#define str(s)
Definition: TestProcessor.cc:53
MainPageGenerator.getPackages
def getPackages(packagesPagePath)
Definition: MainPageGenerator.py:83
mps_setup.append
append
Definition: mps_setup.py:85
MainPageGenerator.costumFormatter
def costumFormatter(inp)
Definition: MainPageGenerator.py:121
format
MainPageGenerator.prepareTemplate
def prepareTemplate()
Definition: MainPageGenerator.py:110
MainPageGenerator.fillContentTemplate
def fillContentTemplate(domains)
Definition: MainPageGenerator.py:136