CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions
MainPageGenerator.MainPageGenerator Class Reference

MainPageGenerator class is used for generating main page that contains domain trees (Analysis, Calibration and Alignment, Core, DAQ etc.) More...

Public Member Functions

def __init__ (self, dataPath, path, cmsVer="")
 Constructor method. More...
 
def CreateBuildRefMan (self)
 
def CreateNewMainPage (self, outputFileName)
 
def ExportJSON (self, fileName)
 
def GetFileName (self, fileName)
 
def HTMLTreeAddItem (self, title, links=None, endNode=False, folder=False)
 
def HTMLTreeBegin (self, title, links={})
 
def HTMLTreeEnd (self)
 
def ParseJsonFromURL (self, URL)
 
def PrepareData (self)
 
def ReadFile (self, fileName, pathFlag=True)
 
def WriteFile (self, fileName, data)
 

Public Attributes

 classes
 
 classesSource
 
 classesURLs
 
 CMSSWURL
 
 CMSVER
 
 contentStamp
 
 data
 
 dataPath
 
 domains
 
 filesSource
 
 GitLink
 
 head
 
 links
 
 mainPageTemplate
 
 managers
 
 managersURL
 
 packages
 
 packageSource
 
 path
 
 title
 
 treePageTamplate
 
 tWikiLinks
 
 users
 
 usersURL
 

Private Member Functions

def __GetHTMLItemDepth (self, item)
 
def __HTMLFileName (self, fileName)
 
def __NewTreePage (self, domain)
 
def __ParseItem (self, str_)
 
def __ParseSubItem (self, str_)
 

Detailed Description

MainPageGenerator class is used for generating main page that contains domain trees (Analysis, Calibration and Alignment, Core, DAQ etc.)

Definition at line 7 of file MainPageGenerator.py.

Constructor & Destructor Documentation

def MainPageGenerator.MainPageGenerator.__init__ (   self,
  dataPath,
  path,
  cmsVer = "" 
)

Constructor method.

Parameters
dataPathparameter gives path of data directory that contains .js, .css and image files needed for generating tree pages
pathis the reference manual directory path and it is used as destination and source.
cmsVeris version of CMSSW.

Definition at line 12 of file MainPageGenerator.py.

12  def __init__(self, dataPath, path, cmsVer = ""):
13  self.path = path
14  self.dataPath = dataPath
15 
16  self.CMSVER = cmsVer
17 
18  self.managersURL = 'http://cmsdoxy.web.cern.ch/cmsdoxy/tcproxy.php?type=managers'
19  self.usersURL = 'http://cmsdoxy.web.cern.ch/cmsdoxy/tcproxy.php?type=users'
20  self.CMSSWURL = 'http://cmsdoxy.web.cern.ch/cmsdoxy/tcproxy.php?type=packages&release=CMSSW_4_4_2'
21 
22  self.tWikiLinks = {'Analysis':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrab',
23  'Calibration and Alignment':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCalAli',
24  'Core':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrameWork',
25  'DAQ':'https://twiki.cern.ch/twiki/bin/view/CMS/TriDASWikiHome',
26  'DQM':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideDQM',
27  'Database':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCondDB',
28  'Documentation':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuide',
29  'Fast Simulation':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFastSimulation',
30  'Full Simulation':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideSimulation',
31  'Generators':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideEventGeneration',
32  'Geometry':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideDetectorDescription',
33  'HLT':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideHighLevelTrigger',
34  'L1':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideL1Trigger',
35  'Reconstruction':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideReco',
36  'Visualization':'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideVisualization'}
37 
38  self.data = None
39 
40  self.GitLink = "https://github.com/cms-sw/cmssw/tree/" + self.CMSVER + "/%s/%s"
41 
42  self.title = "<center>\n<h1>CMSSW Documentation</h1>\n<h2>" + self.CMSVER + "</h2>\n</center>\n"
43  self.links = """
44 <p style="margin-left:10px;">
45 Learn <a href="ReferenceManual.html">how to build Reference Manual</a><br>
46 Learn more about <a target="_blank" href="http://www.stack.nl/~dimitri/doxygen/commands.html">special doxygen commands</a>
47 </p>\n\n"""
48  self.head = """
49 <!-- Content Script & Style -->
50 <script type="text/javascript">
51 var itemList = [];
52 
53 function toggleHoba(item, path)
54 {
55  for(var i = 0; i < itemList.length; i++)
56  {
57  if(itemList[i] == item)
58  {
59  var iframe = $("#"+itemList[i]+"_div").children("iframe:first");
60  if(!iframe.attr("src"))
61  {
62  iframe.attr("src", path)
63  }
64  $("#"+item+"_div").slideToggle();
65  }
66  else
67  $("#"+itemList[i]+"_div").slideUp();
68  }
69 }
70 
71 $(document).ready(function() {
72 searchBox.OnSelectItem(0);
73 $(".doctable").find("td").each(function(){ if (this.id.indexOf("hoba_") != -1)itemList.push(this.id);});
74 });
75 </script>
76 <style>
77 .DCRow
78 {
79  background: #eeeeff;
80  border-spacing: 0px;
81  padding: 0px;
82  border-bottom: 1px solid #c1c1dc;
83 }
84 
85 .DCRow:hover
86 {
87  background: #cde4ec;
88 }
89 </style>
90 <!-- Content Script & Style -->
91  """
92  self.contentStamp = '$CONTENT$'
93  self.mainPageTemplate = self.ReadFile("index.html")
94  self.WriteFile("index_backup.html", self.mainPageTemplate) #backup file
95  soup = BeautifulSoup(self.mainPageTemplate)
96  soup.head.insert(len(soup.head), self.head)
97 
98  contents = soup.find("div", { "class" : "contents" })
99  for child in contents.findChildren():
100  child.extract()
101  contents.insert(0, self.contentStamp)
102  self.mainPageTemplate = str(soup)
103  self.mainPageTemplate = self.mainPageTemplate.replace("CSCDQM Framework Guide", "")
104  self.mainPageTemplate = self.mainPageTemplate.replace('&lt;','<').replace('&gt;', '>')
105  print("Main page template created...")
106 
107  self.CreateBuildRefMan()
108  print("RefMan created...")
109 
110  self.treePageTamplate = self.ReadFile(self.dataPath + "tree_template.html", pathFlag = False)
111  self.classesSource = self.ReadFile("classes.html")
112  self.filesSource = self.ReadFile("files.html")
113  self.packageSource = self.ReadFile("pages.html")
114 
def WriteFile(self, fileName, data)
def __init__(self, dataPath, path, cmsVer="")
Constructor method.
def replace(string, replacements)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def ReadFile(self, fileName, pathFlag=True)
#define str(s)

Member Function Documentation

def MainPageGenerator.MainPageGenerator.__GetHTMLItemDepth (   self,
  item 
)
private

Definition at line 155 of file MainPageGenerator.py.

References KineDebug3.count().

155  def __GetHTMLItemDepth(self, item):
156  return item["id"].count("_") - 1 # 1 for doxygen 1.8.5, 2 for old ver.
157 
def MainPageGenerator.MainPageGenerator.__HTMLFileName (   self,
  fileName 
)
private

Definition at line 158 of file MainPageGenerator.py.

References python.rootplot.root2matplotlib.replace().

158  def __HTMLFileName(self, fileName):
159  return fileName.lower().replace(' ', '_')
160 
def replace(string, replacements)
def MainPageGenerator.MainPageGenerator.__NewTreePage (   self,
  domain 
)
private

Definition at line 343 of file MainPageGenerator.py.

References CombinedSVCalibration.data, CombinedTauTagCalibration.data, TrackProbabilityCalibration.data, ElectronLikelihoodCalibration.data, KDTreeNodeInfo< DATA >.data, classes.PlotData.data, QGLikelihoodObject.data, MainPageGenerator.MainPageGenerator.data, LASModuleProfile.data, KDTreeNodes< DATA >.data, QGLikelihoodSystematicsObject.data, TkLasBeam.data, GeometryComparisonPlotter.data, EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients.data, edm::MapOfVectors< K, T >::Iter.data, edm::DetSet< T >.data, EcalShowerContainmentCorrections::Coefficients.data, MainPageGenerator.MainPageGenerator.HTMLTreeAddItem(), MainPageGenerator.MainPageGenerator.HTMLTreeBegin(), MainPageGenerator.MainPageGenerator.HTMLTreeEnd(), relativeConstraints.keys, edm.print(), python.rootplot.root2matplotlib.replace(), MainPageGenerator.MainPageGenerator.treePageTamplate, MainPageGenerator.MainPageGenerator.tWikiLinks, and MainPageGenerator.MainPageGenerator.WriteFile().

Referenced by MainPageGenerator.MainPageGenerator.CreateNewMainPage().

343  def __NewTreePage(self, domain):
344 
345  if domain not in self.data: return
346 
347  content = ''
348  keysI = sorted(self.data[domain].keys())
349  for i in keysI:
350  if i == '__DATA__': continue
351  content += self.HTMLTreeBegin(i)
352  keysJ = sorted(self.data[domain][i].keys())
353  for j in keysJ:
354 # if len(self.data[domain][i][j].keys()) == 1:
355 # if self.data[domain][i][j].has_key("__DATA__"):
356 # content += self.HTMLTreeAddItem(j, self.data[domain][i][j]["__DATA__"])
357 # else:
358 # content += self.HTMLTreeAddItem(j)
359 # continue
360  keysK = sorted(self.data[domain][i][j].keys())
361  length = len(keysK)
362 # content += "<!-- Begin -->"
363  if length > 1:
364  if "__DATA__" in self.data[domain][i][j]:
365  content += self.HTMLTreeBegin(j, self.data[domain][i][j]["__DATA__"])
366  else:
367  content += self.HTMLTreeBegin(j)
368  else:
369  if "__DATA__" in self.data[domain][i][j]:
370  content += self.HTMLTreeAddItem(j, self.data[domain][i][j]["__DATA__"], folder = True)
371  else:
372  content += self.HTMLTreeAddItem(j, folder = True)
373 
374  for k in keysK:
375  if k == '__DATA__': continue
376  if self.data[domain][i][j][k]["__DATA__"]: content += self.HTMLTreeAddItem(k, self.data[domain][i][j][k]["__DATA__"])
377  else: content += self.HTMLTreeAddItem(k)
378  if length > 1:
379  content += self.HTMLTreeEnd()
380 # content += "<!-- End -->"
381  content += self.HTMLTreeEnd()
382  if domain in self.tWikiLinks:
383  self.WriteFile("iframes/%s.html" % domain.lower().replace(' ', '_'), self.treePageTamplate % (domain, self.tWikiLinks[domain], content))
384  else:
385  print('Warning: The twiki link of "%s" domain not found...' % domain)
386  self.WriteFile("iframes/%s.html" % domain.lower().replace(' ', '_'), self.treePageTamplate % (domain, '#', content))
387 
def WriteFile(self, fileName, data)
def HTMLTreeAddItem(self, title, links=None, endNode=False, folder=False)
def replace(string, replacements)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def HTMLTreeBegin(self, title, links={})
def MainPageGenerator.MainPageGenerator.__ParseItem (   self,
  str_ 
)
private

Definition at line 146 of file MainPageGenerator.py.

146  def __ParseItem(self, str_):
147  return str_[0:str_.find('/')]
148 
def MainPageGenerator.MainPageGenerator.__ParseSubItem (   self,
  str_ 
)
private

Definition at line 149 of file MainPageGenerator.py.

149  def __ParseSubItem(self, str_):
150  if '/' in str_:
151  return str_[str_.find('/')+1:]
152  else:
153  return None
154 
def MainPageGenerator.MainPageGenerator.CreateBuildRefMan (   self)

Definition at line 262 of file MainPageGenerator.py.

References MainPageGenerator.MainPageGenerator.contentStamp, and MainPageGenerator.MainPageGenerator.WriteFile().

262  def CreateBuildRefMan(self):
263  content = """<h1>The Reference Manual </h1>
264  This is the CMSSW Reference Manual, the reference documentation of all classes and packages in CMSSW.<p>
265  This page explains how to write the documentation for your code.
266 
267  </p><h2>Class Documentation</h2>
268 
269  Classes and methods are documented with properly formatted <a target="_blank" class="el" href="d3/d88/namespacecomments.html">comments</a> in the code.<p>
270  Here is a template of a documented <a target="_blank" href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/Documentation/CodingRules/Template.h?rev=HEAD&amp;cvsroot=CMSSW&amp;content-type=text/vnd.viewcvs-markup">.h file</a>, and of a <a target="_blank" href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/Documentation/CodingRules/Template.cc?rev=HEAD&amp;cvsroot=CMSSW&amp;content-type=text/vnd.viewcvs-markup">.cc file</a>. The resulting doxygen page is <a target="_blank" class="el" href="d6/d3e/classTemplate.html">here</a>.
271 
272  </p><h2>Package Documentation</h2>
273 
274  Each package should contain a very brief description of its content and purpose. Remember that this is a reference, and not a user's guide: tutorials, howtos, etc. are best documented in the <a target="_blank" href="https://twiki.cern.ch/twiki/bin/view/CMS/SWGuide">CMS Offline Guide</a> and in the <a target="_blank" href="https://twiki.cern.ch/twiki/bin/view/CMS/WorkBook">WorkBook</a>. Cross links between the CMS Offline Guide and the WorkBook and this manual are a good way to avoid duplication of content.<p>
275  This documentation should be written in a file [Package]/doc/[Package].doc. The simplest way of doing this is to go to the doc/ directory in your package and then run the script
276  <a target="_blank" href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/*checkout*/CMSSW/Documentation/ReferenceManualScripts/scripts/makePackageDoc?rev=HEAD&amp;cvsroot=CMSSW">makePackageDoc</a>,
277  which is available in your PATH.
278 
279  </p><h2> How to generate your documentation locally </h2>
280  One you have updated your documentation, you can look at how it displays in the following way:
281 
282  <ul>
283  <li>check out the following packages:
284  <pre> &gt; cmsrel CMSSW_7_X_X
285  &gt; cd CMSSW_7_X_X/
286  &gt; cmsenv
287  &gt; git cms-addpkg Documentation
288 
289  &gt; generate_reference_manual
290 
291  wait...
292 
293  &gt; firefox doc/html/index.html </pre>
294  </li>
295  </ul>"""
296  self.WriteFile('ReferenceManual.html', self.mainPageTemplate.replace(self.contentStamp, content))
297 
def WriteFile(self, fileName, data)
def MainPageGenerator.MainPageGenerator.CreateNewMainPage (   self,
  outputFileName 
)

Definition at line 298 of file MainPageGenerator.py.

References MainPageGenerator.MainPageGenerator.__NewTreePage(), MainPageGenerator.MainPageGenerator.contentStamp, CombinedSVCalibration.data, CombinedTauTagCalibration.data, TrackProbabilityCalibration.data, ElectronLikelihoodCalibration.data, KDTreeNodeInfo< DATA >.data, classes.PlotData.data, QGLikelihoodObject.data, MainPageGenerator.MainPageGenerator.data, LASModuleProfile.data, KDTreeNodes< DATA >.data, QGLikelihoodSystematicsObject.data, TkLasBeam.data, GeometryComparisonPlotter.data, EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients.data, edm::MapOfVectors< K, T >::Iter.data, edm::DetSet< T >.data, EcalShowerContainmentCorrections::Coefficients.data, MainPageGenerator.MainPageGenerator.links, MainPageGenerator.MainPageGenerator.PrepareData(), python.rootplot.root2matplotlib.replace(), classes.PlotData.title, preexistingValidation.PreexistingValidation.title, MainPageGenerator.MainPageGenerator.title, alignment.Alignment.title, SiPixelGenErrorHeader.title, big::bigHeader.title, SiPixelTemplateHeader2D.title, presentation.SubsectionBase.title, Geometry.title, TkAlMap.TkAlMap.title, TrackerMap.title, SiPixelTemplateHeader.title, and MainPageGenerator.MainPageGenerator.WriteFile().

298  def CreateNewMainPage(self, outputFileName):
299  if self.data == None:
300  self.PrepareData()
301 
302  contents = """
303  <table class="doctable" border="0" cellpadding="0" cellspacing="0">
304  <tbody>
305  <tr class="top" valign="top">
306  <th class="domain">Domain</th><th class="contact">Contact</th>
307  </tr>
308  """
309  keysI = sorted(self.data.keys())
310  for i in keysI:
311  #########################
312  if i == 'Other': continue
313 
314  self.__NewTreePage(i)
315  contents = contents + '\n<tr class="DCRow">\n' ######### TAG: TR1
316  #########################
317  if i == 'Operations':
318  contents = contents + """<td width="50%%" style="padding:8px">%s</td>\n""" % i
319  else:
320  contents = contents + """<td width="50%%" style="padding:8px;cursor:pointer" onclick="toggleHoba('hoba_%s', 'iframes/%s.html')" id="hoba_%s"><a>%s</a></td>\n""" % (i.replace(' ', '_'), i.lower().replace(' ', '_'), i.replace(' ', '_'), i)
321  #########################
322 
323  contents = contents + '<td width="50%" class="contact">'
324  for j in range(len(self.data[i]["__DATA__"]["Contact"])):
325  if j == len(self.data[i]["__DATA__"]["Contact"]) - 1:
326  contents = contents + '<a href="mailto:%s">%s</a> ' % (self.data[i]["__DATA__"]["Contact"][j][1], self.data[i]["__DATA__"]["Contact"][j][0])
327  else:
328  contents = contents + '<a href="mailto:%s">%s</a>, ' % (self.data[i]["__DATA__"]["Contact"][j][1], self.data[i]["__DATA__"]["Contact"][j][0])
329  contents = contents + '</td>\n'
330  contents = contents + '</tr>\n\n' ######### TAG: TR1
331  #########################
332  if i == 'Operations': continue
333  #########################
334  contents = contents + """
335  <tr><td colspan="2" style="background:#d7dbe3">
336  <div style="display:none;" id="hoba_%s_div"><iframe width="100%%" frameborder="0"></iframe></div>
337  </td></tr>
338  """ % (i.replace(' ', '_'))
339 
340  contents = contents + "</table>"
341  self.WriteFile(outputFileName, self.mainPageTemplate.replace(self.contentStamp, self.title + contents + self.links))
342 
def WriteFile(self, fileName, data)
def replace(string, replacements)
def CreateNewMainPage(self, outputFileName)
def MainPageGenerator.MainPageGenerator.ExportJSON (   self,
  fileName 
)
def MainPageGenerator.MainPageGenerator.GetFileName (   self,
  fileName 
)
This method returns file name without extension

Definition at line 134 of file MainPageGenerator.py.

134  def GetFileName(self, fileName):
135  """This method returns file name without extension"""
136  if '.' in fileName:
137  return fileName[0:fileName.find('.')]
138  else:
139  return fileName
140 
def MainPageGenerator.MainPageGenerator.HTMLTreeAddItem (   self,
  title,
  links = None,
  endNode = False,
  folder = False 
)

Definition at line 400 of file MainPageGenerator.py.

References edm.print().

Referenced by MainPageGenerator.MainPageGenerator.__NewTreePage().

400  def HTMLTreeAddItem(self, title, links = None, endNode = False, folder = False):
401  if endNode: html = '\t<li class="last">'
402  else: html = '\t<li>'
403 
404  if isinstance(links, str) or isinstance(links, type(u'')):
405  if folder:
406  html = html + '\t<a href="%s" target="_blank" class=""><span class="emptyFolder">%s</span></a>\n' % (links, title)
407  else:
408  html = html + '\t<a href="%s" target="_blank" class=""><span class="file">%s</span></a>\n' % (links, title)
409  elif isinstance(links, dict):
410  if folder:
411  html = html + '<span class="emptyFolder">%s ' % title
412  else:
413  html = html + '<span class="file">%s ' % title
414  for i in links.keys():
415  html = html + '<a target="_blank" href="%s">[%s]</a> \n' % (links[i], i)
416  html = html + '</span>'
417  else:
418  html = html + '\t<span class="file">%s</span>\n' % title
419  return html + '\t</li>\n'
420 
def HTMLTreeAddItem(self, title, links=None, endNode=False, folder=False)
def MainPageGenerator.MainPageGenerator.HTMLTreeBegin (   self,
  title,
  links = {} 
)

Definition at line 388 of file MainPageGenerator.py.

Referenced by MainPageGenerator.MainPageGenerator.__NewTreePage().

388  def HTMLTreeBegin(self, title, links = {}):
389  html = '\n<li>\n<div class="hitarea expandable-hitarea"></div>\n'
390  html = html + '<span class="folder">%s\n' % title
391  for i in links.keys():
392  html = html + '<a target="_blank" href="%s">[%s]</a> \n' % (links[i], i)
393  html = html + '</span>\n'
394  html = html + '<ul style="display: block;">\n'
395  return html
396 
def HTMLTreeBegin(self, title, links={})
def MainPageGenerator.MainPageGenerator.HTMLTreeEnd (   self)

Definition at line 397 of file MainPageGenerator.py.

Referenced by MainPageGenerator.MainPageGenerator.__NewTreePage().

397  def HTMLTreeEnd(self):
398  return '</li></ul>\n\n'
399 
def MainPageGenerator.MainPageGenerator.ParseJsonFromURL (   self,
  URL 
)
This method returns data which is read from URL

Definition at line 141 of file MainPageGenerator.py.

141  def ParseJsonFromURL(self, URL):
142  """This method returns data which is read from URL"""
143  u = urllib2.urlopen(URL)
144  return json.loads(u.read())
145 
def MainPageGenerator.MainPageGenerator.PrepareData (   self)

Definition at line 161 of file MainPageGenerator.py.

Referenced by MainPageGenerator.MainPageGenerator.CreateNewMainPage(), and MainPageGenerator.MainPageGenerator.ExportJSON().

161  def PrepareData(self):
163  print("Managers loaded and parsed...")
164 
165  self.users = self.ParseJsonFromURL(self.usersURL)
166  print("Users loaded and parsed...")
167 
168  self.data = {}
169  for i in self.managers.keys():
170  self.data[i] = {"__DATA__":{"Contact":[]}}
171  for j in self.managers[i]:
172  self.data[i]["__DATA__"]["Contact"].append(self.users[j])
174  print("Domains loaded and parsed...")
175 
176  for i in self.domains.keys():
177  for j in self.domains[i]:
178  if self.__ParseItem(j) not in self.data[i]:
179  self.data[i][self.__ParseItem(j)] = {}
180  if self.__ParseSubItem(j) not in self.data[i][self.__ParseItem(j)]:
181  self.data[i][self.__ParseItem(j)][self.__ParseSubItem(j)] = {}
182 
183  self.data[i][self.__ParseItem(j)][self.__ParseSubItem(j)]["__DATA__"] = {
184  'git': self.GitLink % (self.__ParseItem(j), self.__ParseSubItem(j))
185  }
186 
187  # for getting package links
188  soup = BeautifulSoup(self.packageSource)
189  contents = soup.find("div", { "class" : "contents" })
190  li = contents.findAll("tr", {})
191 
192  self.packages = {}
193  for i in li:
194  if i.a["href"]:
195  self.packages[i.a.text] = i.a["href"]
196  print("Packages parsed(%d)..." % len(self.packages))
197 
198  # for getting items from file.html
199  soup = BeautifulSoup(self.filesSource)
200  contents = soup.find("div", { "class" : "contents" })
201  tr = contents.findAll("tr", {})
202  self.classes= {}
203  origin = 0
204  if tr[0].text == 'src': origin = -1
205  # depth of interface items can be only 3
206  flag = False
207  for i in tr:
208  if self.__GetHTMLItemDepth(i) + origin == 1:
209  self.classes[i.text] = {}
210  level1 = i.text
211  flag = False
212 
213  if self.__GetHTMLItemDepth(i) + origin == 2:
214  self.classes[level1][i.text] = {}
215  level2 = i.text
216  flag = False
217 
218  if self.__GetHTMLItemDepth(i) + origin == 3 and i.text == u'interface':
219  flag = True
220  if self.__GetHTMLItemDepth(i) + origin == 3 and i.text != u'interface':
221  flag = False
222 
223 # print i.text, self.__GetHTMLItemDepth(i)
224 # raw_input()
225 
226  if flag and i.text != u'interface':
227  self.classes[level1][level2][i.text] = i.a["href"]
228  #self.ZEG = i
229  print("Class hierarchy loaded(%d)..." % len(self.classes))
230 
231 # self.WriteFile("dbg.json", json.dumps(self.classes, indent = 1))
232 
233  # for parsing classes links from classes.html
234  soup = BeautifulSoup(self.classesSource)
235  contents = soup.find("div", { "class" : "contents" })
236  td = contents.findAll("td", {})
237  self.classesURLs = {}
238  # add items to self.classesURLs
239  for i in td:
240  if i.a and 'href' in i.a:
241  self.classesURLs[i.a.text] = i.a['href']
242  print("Class URLs was loaded... (%s)" % len(self.classesURLs))
243 
244  for i in self.data.keys():
245  for j in self.data[i].keys():
246  if j not in self.classes: continue
247  for k in self.data[i][j].keys():
248  if "Package " + j + "/" + k in self.packages:
249  self.data[i][j][k]["__DATA__"]["packageDoc"] = '../' + self.packages["Package " + j + "/" + k]
250  if k not in self.classes[j]: continue
251  for h in self.classes[j][k]:
252  if self.GetFileName(h) in self.classesURLs:
253  self.data[i][j][k][self.GetFileName(h)] = {"__DATA__": '../' + self.classesURLs[self.GetFileName(h)]}
254  else:
255  self.data[i][j][k][self.GetFileName(h) + ".h"] = {"__DATA__": '../' + self.classes[j][k][h]}
256 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def MainPageGenerator.MainPageGenerator.ReadFile (   self,
  fileName,
  pathFlag = True 
)
This method reads file directly or from path.

Definition at line 115 of file MainPageGenerator.py.

References MainPageGenerator.MainPageGenerator.path, presentation.ValidationPlots.path, SiStripGainFromCalibTree.path, and edm.print().

115  def ReadFile(self, fileName, pathFlag = True):
116  """This method reads file directly or from path."""
117  if pathFlag:
118  print("Read:", self.path + fileName)
119  f = open(self.path + fileName)
120  else:
121  f = open(fileName)
122  print("Read:", fileName)
123  data = f.read()
124  f.close()
125  return data
126 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def ReadFile(self, fileName, pathFlag=True)
def MainPageGenerator.MainPageGenerator.WriteFile (   self,
  fileName,
  data 
)
This method writes data

Definition at line 127 of file MainPageGenerator.py.

References MainPageGenerator.MainPageGenerator.path, presentation.ValidationPlots.path, SiStripGainFromCalibTree.path, and edm.print().

Referenced by MainPageGenerator.MainPageGenerator.__NewTreePage(), MainPageGenerator.MainPageGenerator.CreateBuildRefMan(), MainPageGenerator.MainPageGenerator.CreateNewMainPage(), and MainPageGenerator.MainPageGenerator.ExportJSON().

127  def WriteFile(self, fileName, data):
128  """This method writes data"""
129  print("Write:", self.path + fileName)
130  f = open(self.path + fileName, "w")
131  f.write(data)
132  f.close()
133 
def WriteFile(self, fileName, data)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66

Member Data Documentation

MainPageGenerator.MainPageGenerator.classes

Definition at line 202 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.classesSource

Definition at line 111 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.classesURLs

Definition at line 237 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.CMSSWURL

Definition at line 20 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.CMSVER

Definition at line 16 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.contentStamp
MainPageGenerator.MainPageGenerator.data
MainPageGenerator.MainPageGenerator.dataPath

Definition at line 14 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.domains

Definition at line 173 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.filesSource

Definition at line 112 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.GitLink

Definition at line 40 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.head

Definition at line 48 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.links
MainPageGenerator.MainPageGenerator.mainPageTemplate

Definition at line 93 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.managers

Definition at line 162 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.managersURL

Definition at line 18 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.packages

Definition at line 192 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.packageSource

Definition at line 113 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.path
MainPageGenerator.MainPageGenerator.title
MainPageGenerator.MainPageGenerator.treePageTamplate
MainPageGenerator.MainPageGenerator.tWikiLinks
MainPageGenerator.MainPageGenerator.users

Definition at line 165 of file MainPageGenerator.py.

MainPageGenerator.MainPageGenerator.usersURL

Definition at line 19 of file MainPageGenerator.py.