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

◆ __init__()

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 __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
def replace(string, replacements)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

Member Function Documentation

◆ __GetHTMLItemDepth()

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

Definition at line 155 of file MainPageGenerator.py.

References submitPVResolutionJobs.count.

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

◆ __HTMLFileName()

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)

◆ __NewTreePage()

def MainPageGenerator.MainPageGenerator.__NewTreePage (   self,
  domain 
)
private

Definition at line 343 of file MainPageGenerator.py.

References CombinedSVCalibration.data, CombinedTauTagCalibration.data, TrackProbabilityCalibration.data, ecal::DigisCollection< StoragePolicy >.data, ElectronLikelihoodCalibration.data, classes.PlotData.data, QGLikelihoodObject.data, KDTreeNodeInfo< DATA, DIM >.data, calo::multifit::MapSymM< T, Stride, Order >.data, LASModuleProfile.data, MainPageGenerator.MainPageGenerator.data, QGLikelihoodSystematicsObject.data, GeometryComparisonPlotter.data, TkLasBeam.data, KDTreeNodes< DATA, DIM >.data, calo::multifit::MapMForPM< T >.data, EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients.data, edm::MapOfVectors< K, T >::Iter.data, EcalShowerContainmentCorrections::Coefficients.data, edm::DetSet< T >.data, CTPPSCompositeESSource::BinData< T >.data, hcal::DigiCollectionBase< StoragePolicy >.data, MainPageGenerator.MainPageGenerator.HTMLTreeAddItem(), MainPageGenerator.MainPageGenerator.HTMLTreeBegin(), MainPageGenerator.MainPageGenerator.HTMLTreeEnd(), relativeConstraints.keys, 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 replace(string, replacements)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ __ParseItem()

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 

◆ __ParseSubItem()

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 

◆ CreateBuildRefMan()

def MainPageGenerator.MainPageGenerator.CreateBuildRefMan (   self)

Definition at line 262 of file MainPageGenerator.py.

References MainPageGenerator.MainPageGenerator.contentStamp, MainPageGenerator.MainPageGenerator.mainPageTemplate, python.rootplot.root2matplotlib.replace(), 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 replace(string, replacements)

◆ CreateNewMainPage()

def MainPageGenerator.MainPageGenerator.CreateNewMainPage (   self,
  outputFileName 
)

Definition at line 298 of file MainPageGenerator.py.

References MainPageGenerator.MainPageGenerator.__NewTreePage(), MainPageGenerator.MainPageGenerator.contentStamp, CombinedTauTagCalibration.data, CombinedSVCalibration.data, TrackProbabilityCalibration.data, ecal::DigisCollection< StoragePolicy >.data, ElectronLikelihoodCalibration.data, classes.PlotData.data, QGLikelihoodObject.data, KDTreeNodeInfo< DATA, DIM >.data, calo::multifit::MapSymM< T, Stride, Order >.data, LASModuleProfile.data, MainPageGenerator.MainPageGenerator.data, QGLikelihoodSystematicsObject.data, GeometryComparisonPlotter.data, TkLasBeam.data, KDTreeNodes< DATA, DIM >.data, calo::multifit::MapMForPM< T >.data, EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients.data, edm::MapOfVectors< K, T >::Iter.data, EcalShowerContainmentCorrections::Coefficients.data, edm::DetSet< T >.data, CTPPSCompositeESSource::BinData< T >.data, hcal::DigiCollectionBase< StoragePolicy >.data, relativeConstraints.keys, MainPageGenerator.MainPageGenerator.links, MainPageGenerator.MainPageGenerator.mainPageTemplate, MainPageGenerator.MainPageGenerator.PrepareData(), FastTimerService_cff.range, python.rootplot.root2matplotlib.replace(), classes.PlotData.title, MainPageGenerator.MainPageGenerator.title, SiPixelGenErrorHeader.title, big::bigHeader.title, SiPixelTemplateHeader2D.title, Geometry.title, TkAlMap.TkAlMap.title, TrackerMap.title, SiPixelTemplateHeader.title, templateHelper::SiPixelTemplateHeaderInfo< PayloadType, StoreType, TransientType, myType, myParam >::header_info.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'
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'
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 replace(string, replacements)

◆ ExportJSON()

def MainPageGenerator.MainPageGenerator.ExportJSON (   self,
  fileName 
)

◆ GetFileName()

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 

◆ HTMLTreeAddItem()

def MainPageGenerator.MainPageGenerator.HTMLTreeAddItem (   self,
  title,
  links = None,
  endNode = False,
  folder = False 
)

Definition at line 400 of file MainPageGenerator.py.

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 

◆ HTMLTreeBegin()

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 

◆ HTMLTreeEnd()

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 

◆ ParseJsonFromURL()

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 

◆ PrepareData()

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):
162  self.managers = self.ParseJsonFromURL(self.managersURL)
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])
173  self.domains = self.ParseJsonFromURL(self.CMSSWURL)
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 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ ReadFile()

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, METCorrectorDBWriter.path, JetCorrectorDBWriter.path, SiStripGainFromCalibTree.path, and 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 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ WriteFile()

def MainPageGenerator.MainPageGenerator.WriteFile (   self,
  fileName,
  data 
)
This method writes data

Definition at line 127 of file MainPageGenerator.py.

References MainPageGenerator.MainPageGenerator.path, METCorrectorDBWriter.path, JetCorrectorDBWriter.path, SiStripGainFromCalibTree.path, and 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 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Data Documentation

◆ classes

MainPageGenerator.MainPageGenerator.classes

Definition at line 202 of file MainPageGenerator.py.

Referenced by ClassesDefXmlUtils.XmlParser.start_element().

◆ classesSource

MainPageGenerator.MainPageGenerator.classesSource

Definition at line 111 of file MainPageGenerator.py.

◆ classesURLs

MainPageGenerator.MainPageGenerator.classesURLs

Definition at line 237 of file MainPageGenerator.py.

◆ CMSSWURL

MainPageGenerator.MainPageGenerator.CMSSWURL

Definition at line 20 of file MainPageGenerator.py.

◆ CMSVER

MainPageGenerator.MainPageGenerator.CMSVER

Definition at line 16 of file MainPageGenerator.py.

◆ contentStamp

MainPageGenerator.MainPageGenerator.contentStamp

◆ data

MainPageGenerator.MainPageGenerator.data

◆ dataPath

MainPageGenerator.MainPageGenerator.dataPath

Definition at line 14 of file MainPageGenerator.py.

◆ domains

MainPageGenerator.MainPageGenerator.domains

Definition at line 173 of file MainPageGenerator.py.

◆ filesSource

MainPageGenerator.MainPageGenerator.filesSource

Definition at line 112 of file MainPageGenerator.py.

◆ GitLink

MainPageGenerator.MainPageGenerator.GitLink

Definition at line 40 of file MainPageGenerator.py.

◆ head

MainPageGenerator.MainPageGenerator.head

Definition at line 48 of file MainPageGenerator.py.

◆ links

MainPageGenerator.MainPageGenerator.links

◆ mainPageTemplate

MainPageGenerator.MainPageGenerator.mainPageTemplate

◆ managers

MainPageGenerator.MainPageGenerator.managers

Definition at line 162 of file MainPageGenerator.py.

◆ managersURL

MainPageGenerator.MainPageGenerator.managersURL

Definition at line 18 of file MainPageGenerator.py.

◆ packages

MainPageGenerator.MainPageGenerator.packages

Definition at line 192 of file MainPageGenerator.py.

◆ packageSource

MainPageGenerator.MainPageGenerator.packageSource

Definition at line 113 of file MainPageGenerator.py.

◆ path

MainPageGenerator.MainPageGenerator.path

◆ title

MainPageGenerator.MainPageGenerator.title

◆ treePageTamplate

MainPageGenerator.MainPageGenerator.treePageTamplate

◆ tWikiLinks

MainPageGenerator.MainPageGenerator.tWikiLinks

◆ users

MainPageGenerator.MainPageGenerator.users

Definition at line 165 of file MainPageGenerator.py.

◆ usersURL

MainPageGenerator.MainPageGenerator.usersURL

Definition at line 19 of file MainPageGenerator.py.