CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
ConfigFiles.ConfigFiles Class Reference

ConfigFiles class is used for generating 'config files' html page. More...

Public Member Functions

def __init__
 Constructor method. More...
 
def Check
 
def CreateConfigFilePage
 
def CreateTab
 
def CreateTable
 
def CreateTemplate
 
def FileName
 
def PrepareData
 
def ReadFile
 
def WriteFile
 

Public Attributes

 data
 
 keywords
 
 navBarStamp
 
 NSSource
 
 outputFile
 
 path
 
 prefix
 
 tableStamp
 
 Template
 

Detailed Description

ConfigFiles class is used for generating 'config files' html page.

Definition at line 5 of file ConfigFiles.py.

Constructor & Destructor Documentation

def ConfigFiles.ConfigFiles.__init__ (   self,
  path,
  outputFile,
  prefix = "configfilesList_" 
)

Constructor method.

Parameters
pathis the reference manual directory path and it is used as destination and source.
outputFileis output file name. It should be "configfiles.html" for backward compatibility.
prefixis used for file naming as prefix.

Definition at line 10 of file ConfigFiles.py.

10 
11  def __init__(self, path, outputFile, prefix = "configfilesList_"):
12  self.path = path
13  self.outputFile = outputFile
14  self.prefix = prefix
15  self.keywords = ["_cff", "_cfi", "_cfg"]
16  self.NSSource = self.ReadFile('namespaces.html')
17  self.tableStamp = '$TABLE$'
18  self.navBarStamp = '$NAVBAR$'
19  self.Template = None
20 
21  self.data = {}
def __init__
Constructor method.
Definition: ConfigFiles.py:10

Member Function Documentation

def ConfigFiles.ConfigFiles.Check (   self,
  str_ 
)

Definition at line 53 of file ConfigFiles.py.

References ConfigFiles.ConfigFiles.keywords.

Referenced by ConfigFiles.ConfigFiles.PrepareData().

53 
54  def Check(self, str_):
55  for i in self.keywords:
56  if i in str_:
57  return True
58  return False
def ConfigFiles.ConfigFiles.CreateConfigFilePage (   self)

Definition at line 96 of file ConfigFiles.py.

References ConfigFiles.ConfigFiles.CreateTab(), ConfigFiles.ConfigFiles.CreateTable(), ConfigFiles.ConfigFiles.CreateTemplate(), SelectRuns.SelectRuns.FileName, ConfigFiles.ConfigFiles.FileName(), ConfigFiles.ConfigFiles.navBarStamp, ConfigFiles.ConfigFiles.PrepareData(), python.rootplot.root2matplotlib.replace(), ConfigFiles.ConfigFiles.tableStamp, and ConfigFiles.ConfigFiles.WriteFile().

96 
97  def CreateConfigFilePage(self):
98  self.PrepareData()
99  self.CreateTemplate()
100 
101  keys = self.data.keys()
102  keys.sort()
103 
104  for i in keys:
105  page = self.Template.replace(self.navBarStamp, self.CreateTab(i)).replace(self.tableStamp, self.CreateTable(i))
106  self.WriteFile(self.FileName(i), page)
107  if i == 'A': self.WriteFile('configfiles.html', page)
108 
def ConfigFiles.ConfigFiles.CreateTab (   self,
  current 
)

Definition at line 74 of file ConfigFiles.py.

References SelectRuns.SelectRuns.FileName, and ConfigFiles.ConfigFiles.FileName().

Referenced by Splitter.Splitter.Backup(), ConfigFiles.ConfigFiles.CreateConfigFilePage(), and Splitter.Splitter.CreatePage().

74 
75  def CreateTab(self, current):
76  tabHTML = '<div class="tabs3">\n<ul class="tablist">\n'
77  keys = self.data.keys()
78  keys.sort()
79  for i in keys:
80  if current == i:
81  tabHTML += '<li class="current"><a href="%s"><span>%s</span></a></li>\n' % ('#', i)
82  else:
83  tabHTML += '<li><a href="%s"><span>%s</span></a></li>\n' % (self.FileName(i), i)
84  tabHTML += '</ul>\n</div>\n'
85  return tabHTML
def ConfigFiles.ConfigFiles.CreateTable (   self,
  current 
)

Definition at line 86 of file ConfigFiles.py.

References python.multivaluedict.MyUserList.data, CombinedSVCalibration.data, CombinedTauTagCalibration.data, ConfigFiles.ConfigFiles.data, TrackProbabilityCalibration.data, ElectronLikelihoodCalibration.data, CondIter< DataT >.data, QGLikelihoodObject.data, LASModuleProfile.data, comparisonPlots.data, cond::IOVProxyData.data, QGLikelihoodSystematicsObject.data, TkLasBeam.data, EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients.data, edm::MapOfVectors< K, T >::Iter.data, edm::DetSet< T >.data, EcalShowerContainmentCorrections::Coefficients.data, python.DBCopy.DBCopy.data, conddblib.Payload.data, and relativeConstraints.keys.

Referenced by ConfigFiles.ConfigFiles.CreateConfigFilePage().

86 
87  def CreateTable(self, current):
88  tableHTML = '<table width="100%">\n<tbody>\n'
89  for i in self.data[current].keys():
90  tableHTML += '<tr><td class="indexkey"><a class="el" href="%s"> %s </a></td><td class="indexvalue"></td></tr>' % (self.data[current][i], i)
91  tableHTML += '</tbody>\n</table>\n'
92  return tableHTML
def ConfigFiles.ConfigFiles.CreateTemplate (   self)

Definition at line 41 of file ConfigFiles.py.

References ConfigFiles.ConfigFiles.navBarStamp, ConfigFiles.ConfigFiles.NSSource, ConfigFiles.ConfigFiles.tableStamp, and ConfigFiles.ConfigFiles.Template.

Referenced by ConfigFiles.ConfigFiles.CreateConfigFilePage().

41 
42  def CreateTemplate(self):
43  self.Template = copy.deepcopy(self.NSSource)
44  soup = BeautifulSoup(self.Template)
45  contents = soup.find("div", { "class" : "contents" })
46  navBar = soup.find("div", { "id" : "navrow2", "class" : "tabs2"})
47  for child in contents.findChildren():
48  child.extract()
49  contents.insert(0, self.tableStamp)
50  navBar.insert(len(navBar), self.navBarStamp)
51  self.Template = str(soup)
52  print "Template created..."
def ConfigFiles.ConfigFiles.FileName (   self,
  current 
)

Definition at line 93 of file ConfigFiles.py.

References ConfigFiles.ConfigFiles.prefix, cond::PfnEditor.prefix, and MuonGeometrySanityCheck.prefix.

Referenced by ConfigFiles.ConfigFiles.CreateConfigFilePage(), ConfigFiles.ConfigFiles.CreateTab(), and PopulateDB.PopulateDB.run().

93 
94  def FileName(self, current):
95  return self.prefix + current + ".html"
def ConfigFiles.ConfigFiles.PrepareData (   self)

Definition at line 59 of file ConfigFiles.py.

References ConfigFiles.ConfigFiles.Check(), python.multivaluedict.MyUserList.data, CombinedSVCalibration.data, ConfigFiles.ConfigFiles.data, CombinedTauTagCalibration.data, TrackProbabilityCalibration.data, ElectronLikelihoodCalibration.data, CondIter< DataT >.data, QGLikelihoodObject.data, LASModuleProfile.data, comparisonPlots.data, cond::IOVProxyData.data, QGLikelihoodSystematicsObject.data, TkLasBeam.data, EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients.data, edm::MapOfVectors< K, T >::Iter.data, edm::DetSet< T >.data, EcalShowerContainmentCorrections::Coefficients.data, python.DBCopy.DBCopy.data, conddblib.Payload.data, ConfigFiles.ConfigFiles.NSSource, and pileupCalc.upper.

Referenced by ConfigFiles.ConfigFiles.CreateConfigFilePage(), MainPageGenerator.MainPageGenerator.CreateNewMainPage(), PackageSplitter.PackageSplitter.CreatePackagePage(), PackageSplitter.PackageSplitter.CreateSubPage(), and MainPageGenerator.MainPageGenerator.ExportJSON().

59 
60  def PrepareData(self):
61 
62  soup = BeautifulSoup(self.NSSource)
63  contents = soup.find("div", { "class" : "contents" })
64  td = contents.findAll("td", {})
65 
66  parsedITemCounter = 0
67  for i in td:
68  if i.a and self.Check(i.a.text):
69  if not self.data.has_key(i.a.text[0].upper()):
70  self.data[i.a.text[0].upper()] = {}
71  self.data[i.a.text[0].upper()][i.a.text] = i.a["href"]
72  parsedITemCounter += 1
73  print "Config files parsed(%d)..." % parsedITemCounter
def ConfigFiles.ConfigFiles.ReadFile (   self,
  fileName,
  pathFlag = True 
)
This method reads file directly or from path.

Definition at line 22 of file ConfigFiles.py.

References ConfigFiles.ConfigFiles.path, and ConfigBuilder.ConfigBuilder.path.

Referenced by PackageSplitter.PackageSplitter.AddTab2Page().

22 
23  def ReadFile(self, fileName, pathFlag = True):
24  """This method reads file directly or from path."""
25  if pathFlag:
26  print "Read:", self.path + fileName
27  f = open(self.path + fileName)
28  else:
29  f = open(os.path.split(__file__)[0] + '/' + fileName)
30  print "Read:", fileName
31  data = f.read()
32  f.close()
33  return data
def ConfigFiles.ConfigFiles.WriteFile (   self,
  fileName,
  data 
)
This method writes data

Definition at line 34 of file ConfigFiles.py.

References ConfigFiles.ConfigFiles.path, and ConfigBuilder.ConfigBuilder.path.

Referenced by MainPageGenerator.MainPageGenerator.__NewTreePage(), PackageSplitter.PackageSplitter.AddTab2Page(), MainPageGenerator.MainPageGenerator.CreateBuildRefMan(), ConfigFiles.ConfigFiles.CreateConfigFilePage(), MainPageGenerator.MainPageGenerator.CreateNewMainPage(), PackageSplitter.PackageSplitter.CreatePackagePage(), PackageSplitter.PackageSplitter.CreateSubPage(), and MainPageGenerator.MainPageGenerator.ExportJSON().

34 
35  def WriteFile(self, fileName, data):
36  """This method writes data"""
37  print "Write:", self.path + fileName
38  f = open(self.path + fileName, "w")
39  f.write(data)
40  f.close()

Member Data Documentation

ConfigFiles.ConfigFiles.data

Definition at line 20 of file ConfigFiles.py.

Referenced by cuy.FindIssue.__init__(), MainPageGenerator.MainPageGenerator.__NewTreePage(), MainPageGenerator.MainPageGenerator.CreateNewMainPage(), PackageSplitter.PackageSplitter.CreatePackagePage(), PackageSplitter.PackageSplitter.CreateSubPage(), ConfigFiles.ConfigFiles.CreateTable(), confdb.HLTProcess.customize(), confdb.HLTProcess.dump(), MainPageGenerator.MainPageGenerator.ExportJSON(), confdb.HLTProcess.getRawConfigurationFromDB(), ConfigFiles.ConfigFiles.PrepareData(), and confdb.HLTProcess.releaseSpecificCustomize().

ConfigFiles.ConfigFiles.keywords

Definition at line 14 of file ConfigFiles.py.

Referenced by ConfigFiles.ConfigFiles.Check().

ConfigFiles.ConfigFiles.navBarStamp

Definition at line 17 of file ConfigFiles.py.

Referenced by ConfigFiles.ConfigFiles.CreateConfigFilePage(), and ConfigFiles.ConfigFiles.CreateTemplate().

ConfigFiles.ConfigFiles.NSSource

Definition at line 15 of file ConfigFiles.py.

Referenced by ConfigFiles.ConfigFiles.CreateTemplate(), and ConfigFiles.ConfigFiles.PrepareData().

ConfigFiles.ConfigFiles.outputFile

Definition at line 12 of file ConfigFiles.py.

ConfigFiles.ConfigFiles.path

Definition at line 11 of file ConfigFiles.py.

Referenced by python.rootplot.rootmath.Target.__repr__(), fff_monitoring.DQMMonitor.process_dir(), PackageSplitter.PackageSplitter.ReadFile(), ConfigFiles.ConfigFiles.ReadFile(), MainPageGenerator.MainPageGenerator.ReadFile(), PackageSplitter.PackageSplitter.WriteFile(), ConfigFiles.ConfigFiles.WriteFile(), and MainPageGenerator.MainPageGenerator.WriteFile().

ConfigFiles.ConfigFiles.prefix

Definition at line 13 of file ConfigFiles.py.

Referenced by PackageSplitter.PackageSplitter.__GetFileName(), Splitter.Splitter.Backup(), Splitter.Splitter.CreatePages(), Splitter.Splitter.CreateTab(), and ConfigFiles.ConfigFiles.FileName().

ConfigFiles.ConfigFiles.tableStamp

Definition at line 16 of file ConfigFiles.py.

Referenced by ConfigFiles.ConfigFiles.CreateConfigFilePage(), and ConfigFiles.ConfigFiles.CreateTemplate().

ConfigFiles.ConfigFiles.Template

Definition at line 18 of file ConfigFiles.py.

Referenced by ConfigFiles.ConfigFiles.CreateTemplate().