CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
MainPageGenerator Namespace Reference

Functions

def bsBugFix
 
def costumFormatter
 
def fillContentTemplate
 
def generateTree
 
def generateTreeViewPage
 
def getClasses
 
def getFiles
 
def getPackages
 
def prepareTemplate
 

Variables

tuple classes = getClasses("%s/classes.html" % htmlFilePath)
 
 cmsswVersion = None
 
 contentTmpl = None
 
 contentTmplOrg = None
 
 data = None
 
string dataSrc = 'http://cmsdoxy.web.cern.ch/cmsdoxy/cmssw/'
 
tuple file = file.replace('.h', '')
 
tuple files = getFiles("%s/files.html" % htmlFilePath)
 
tuple fName = domain.replace(' ', '')
 
string githubBase = 'https://github.com/cms-sw/cmssw/tree/{0}/{1}'
 
 htmlFileName = None
 
 htmlFilePath = None
 
 htmlFullPath = None
 
 htmlPage = None
 
tuple link = githubBase.format(cmsswVersion, '%s/%s'%(l1,l2))
 
int loopLimit = loopLimit-1
 
tuple packages = getPackages('%s/pages.html' % htmlFilePath)
 
tuple page = generateTreeViewPage(tree[domain], domain)
 
int successFlag = 3
 
tuple tree = copy.copy(data['CMSSW_CATEGORIES'])
 
 treeViewTmpl = None
 

Function Documentation

def MainPageGenerator.bsBugFix ( )

Definition at line 125 of file MainPageGenerator.py.

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

Definition at line 121 of file MainPageGenerator.py.

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

Definition at line 136 of file MainPageGenerator.py.

References python.multivaluedict.append(), and relativeConstraints.keys.

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

Definition at line 163 of file MainPageGenerator.py.

Referenced by generateTreeViewPage().

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

Definition at line 200 of file MainPageGenerator.py.

References generateTree().

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

Definition at line 99 of file MainPageGenerator.py.

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

Definition at line 40 of file MainPageGenerator.py.

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

Definition at line 83 of file MainPageGenerator.py.

References split.

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

Definition at line 110 of file MainPageGenerator.py.

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

Variable Documentation

tuple MainPageGenerator.classes = getClasses("%s/classes.html" % htmlFilePath)

Definition at line 262 of file MainPageGenerator.py.

list MainPageGenerator.cmsswVersion = None

Definition at line 36 of file MainPageGenerator.py.

tuple MainPageGenerator.contentTmpl = None

Definition at line 32 of file MainPageGenerator.py.

tuple MainPageGenerator.contentTmplOrg = None

Definition at line 31 of file MainPageGenerator.py.

tuple MainPageGenerator.data = None

Definition at line 35 of file MainPageGenerator.py.

list MainPageGenerator.dataSrc = 'http://cmsdoxy.web.cern.ch/cmsdoxy/cmssw/'

Definition at line 33 of file MainPageGenerator.py.

tuple MainPageGenerator.file = file.replace('.h', '')

Definition at line 279 of file MainPageGenerator.py.

tuple MainPageGenerator.files = getFiles("%s/files.html" % htmlFilePath)

Definition at line 256 of file MainPageGenerator.py.

Referenced by HcalCalibrator.endJob(), fillABSRPFiles(), MillePedeAlignmentAlgorithm.getExistingFormattedFiles(), SiStripDbParams.inputDcuInfoXmlFiles(), SiStripDbParams.inputFecXmlFiles(), SiStripDbParams.inputFedXmlFiles(), SiStripDbParams.inputModuleXmlFiles(), pftools::IO.IO(), HcalPatternSource.loadPatterns(), main(), dqm::DQMFileSaverOnline.makeSnapshot(), PlotCombiner(), and MillePedeAlignmentAlgorithm.terminate().

tuple MainPageGenerator.fName = domain.replace(' ', '')

Definition at line 301 of file MainPageGenerator.py.

Referenced by Selection< C, Selector, StoreContainer >.acceptMap(), CaloMeanResponse.CaloMeanResponse(), HPDNoiseReader.getHandle(), ParticlePDG.ParticlePDG(), Selection< C, Selector, StoreContainer >.print(), MEtoEDMConverter.putData(), CSCSectorReceiverLUT.readLUTsFromFile(), HCalSD.readWeightFromFile(), EcalDccWeightBuilder.writeWeightToAsciiFile(), and EcalDccWeightBuilder.writeWeightToRootFile().

string MainPageGenerator.githubBase = 'https://github.com/cms-sw/cmssw/tree/{0}/{1}'

Definition at line 34 of file MainPageGenerator.py.

tuple MainPageGenerator.htmlFileName = None

Definition at line 22 of file MainPageGenerator.py.

tuple MainPageGenerator.htmlFilePath = None

Definition at line 21 of file MainPageGenerator.py.

list MainPageGenerator.htmlFullPath = None

Definition at line 20 of file MainPageGenerator.py.

MainPageGenerator.htmlPage = None

Definition at line 23 of file MainPageGenerator.py.

tuple MainPageGenerator.link = githubBase.format(cmsswVersion, '%s/%s'%(l1,l2))

Definition at line 271 of file MainPageGenerator.py.

Referenced by sipixelobjects::PixelFEDCabling.addLink(), GEMDigiModel.addLinks(), CSCHitAssociator.associateCSCHitId(), CSCHitAssociator.associateHitId(), EcalABAnalyzer.beginJob(), DTReadOutMapping.cacheMap(), SiPixelFrameReverter.findLinkInFed(), DTReadOutMapping.geometryToReadOut(), l1t::MP7BufferDumpToRaw.getBlocks(), l1t::stage2::CaloSetup.getUnpackers(), HLTMuonL3PreFilter.hltFilter(), RPCReadOutMappingWithFastSearch.init(), DTHitAssociator.initEvent(), DTReadOutMapping.insertReadOutGeometryLink(), PixelDataFormatter.interpretRawData(), CSCSPRecord.LCT(), CSCSPRecord.LCTs(), PixelEndcapLinkMaker.links(), PixelBarrelLinkMaker.links(), SiPixelFedCablingMap::Key.operator<(), SiPixelFedCablingTree.pathToDetUnit(), MuonLinksProducerForHLT.produce(), CSCTFPacker.produce(), L3MuonCandidateProducer.produce(), CSCTFUnpacker.produce(), RPCReadOutMapping.rawDataFrame(), DTReadOutMapping.readOutToGeometry(), LaserSorter.renameAsBackup(), CSCCorrelatedLCTDigi.setMPCLink(), SiPixelFedCablingMap.SiPixelFedCablingMap(), l1t::stage2::CaloTowerUnpacker.unpack(), and CSCSPRecord.unpack().

int MainPageGenerator.loopLimit = loopLimit-1

Definition at line 238 of file MainPageGenerator.py.

tuple MainPageGenerator.packages = getPackages('%s/pages.html' % htmlFilePath)

Definition at line 259 of file MainPageGenerator.py.

Referenced by MEtoEDMConverter.endJob().

tuple MainPageGenerator.page = generateTreeViewPage(tree[domain], domain)

Definition at line 300 of file MainPageGenerator.py.

MainPageGenerator.successFlag = 3

Definition at line 236 of file MainPageGenerator.py.

tuple MainPageGenerator.tree = copy.copy(data['CMSSW_CATEGORIES'])

Definition at line 264 of file MainPageGenerator.py.

Referenced by DeDxDiscriminatorLearner.algoAnalyzeTheTree(), SiStripGainFromCalibTree.algoAnalyzeTheTree(), DumpFWRecoGeometry.analyze(), GammaJetAnalysis.beginJob(), AlignmentMonitorSurvey.book(), FFTJetPatRecoProducer.buildDenseProduct(), ConstrainedTreeBuilderT.buildRealTree(), FFTJetPatRecoProducer.buildSparseProduct(), FinalTreeBuilder.buildTree(), ConstrainedTreeBuilder.buildTree(), SiPixelFedCablingMap.cablingTree(), pftools::Exercises3.calibrateCalibratables(), pftools::CalibCompare.calibrateCalibratables(), fwlite::ChainEvent.ChainEvent(), SiStripBackplaneCalibration.createFromTree(), SiPixelLorentzAngleCalibration.createFromTree(), SiStripLorentzAngleCalibration.createFromTree(), fwlite::DataGetterHelper.DataGetterHelper(), TrackerOfflineValidationSummary.endJob(), TrackerOfflineValidation.endJob(), fwlite::EventSetup.exists(), edm::RootOutputFile.finishEndFile(), HPDNoiseReader.HPDNoiseReader(), FWGeometry.loadMap(), edm.numEntries(), DQMRootOutputModule.openFile(), KinematicVertex.operator reco::Vertex(), RootTreeHandler.readTree(), fwlite::EventSetup.recordID(), HcalDetDiagNoiseMonitor.SaveRates(), HcalDetDiagLEDMonitor.SaveReference(), HcalDetDiagPedestalMonitor.SaveReference(), HcalDetDiagLaserMonitor.SaveReference(), PVFitter.setTree(), fftjetcms.sparsePeakTreeToStorable(), TransientTrackKinematicParticle.TransientTrackKinematicParticle(), LagrangeChildUpdator.update(), VirtualKinematicParticle.VirtualKinematicParticle(), MillePedeVariablesIORoot.writeMillePedeVariables(), RootTreeHandler.writeTree(), SiStripBackplaneCalibration.writeTree(), SiStripLorentzAngleCalibration.writeTree(), and SiPixelLorentzAngleCalibration.writeTree().

tuple MainPageGenerator.treeViewTmpl = None

Definition at line 38 of file MainPageGenerator.py.