CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
cfg-viewer.unscheduled Class Reference

Public Member Functions

def __init__ (self, cfgFile, html, quiet, helperDir, fullDir)
 

Private Member Functions

def _calcFilenames (self, name)
 
def _checkType (self, item)
 
def _complexBase (self, parentName, extra)
 
def _createObjects (self)
 
def _doNonSequenceType (self, objs, globalType)
 
def _doSequenceTypes (self, paths, namep)
 
def _filenames (self, name, option="")
 
def _getData (self, objs)
 
def _load (self, name, param, inner)
 
def _mothersDaughters (self, name, item)
 
def _proceed (self, fileName)
 
def _producersConsumers (self)
 
def _saveData (self, name, base, jsonfiles)
 
def _writeDictParent (self, typeName)
 
def _writeModSeqParent (self)
 
def _writeProdConsum (self)
 

Private Attributes

 _allJSFiles
 
 _computed
 
 _config
 
 _daughter
 
 _dictP
 
 _genericTypes
 
 _helperDir
 
 _html
 
 _modSeqP
 
 _parents
 
 _prodConsP
 
 _quiet
 
 _reg
 
 _theDir
 
 _type
 

Detailed Description

Definition at line 10 of file cfg-viewer.py.

Constructor & Destructor Documentation

def cfg-viewer.unscheduled.__init__ (   self,
  cfgFile,
  html,
  quiet,
  helperDir,
  fullDir 
)

Definition at line 11 of file cfg-viewer.py.

11  def __init__(self,cfgFile,html,quiet,helperDir,fullDir):
12  self._html = html
13  #self._serverName = os.path.join(os.path.split(html)[0],"EditingServer.py")
14  self._quiet = quiet
15  self._theDir= fullDir
16  self._helperDir = helperDir
17  self._mother,self._daughter ={},{}
18  self._reg = re.compile("['>]")
19  self._data,self._types,self._genericTypes={},{},{}
20  self._dictP ="DictParent"
21  self._modSeqP = "ModuleSeqParent"
22  self._prodConsP= "ProdConsumParent"
23  self._parents = {
24  "DictParent":{"creator":"dictCreate","simple": True},
25  "ModuleSeqParent":{"creator":"modSeqCreate","simple": False},
26  "ProdConsumParent":{"creator":"prodConCreate","simple": False}
27  }
28  for name,x in six.iteritems(self._parents):
29  x["pfile"] = self._filenames(name)
30  x["cfile"] = self._filenames(x["creator"])
31  self._type = "%stypes.js"%(fullDir)
32  self._allJSFiles =["types.js"]
33  self._config = ConfigDataAccessor.ConfigDataAccessor()
34  self._config.open(cfgFile)
35  self._computed = self._proceed(cfgFile)
36 
def __init__(self, cfgFile, html, quiet, helperDir, fullDir)
Definition: cfg-viewer.py:11
def _filenames(self, name, option="")
Definition: cfg-viewer.py:169
def _proceed(self, fileName)
Definition: cfg-viewer.py:37

Member Function Documentation

def cfg-viewer.unscheduled._calcFilenames (   self,
  name 
)
private
def cfg-viewer.unscheduled._checkType (   self,
  item 
)
private

Definition at line 114 of file cfg-viewer.py.

References cfg-viewer.unscheduled._reg, MELaserPrim._reg, cfg-viewer.doTypes(), cms::dd.split(), and str.

Referenced by cfg-viewer.unscheduled._doNonSequenceType(), and cfg-viewer.unscheduled._doSequenceTypes().

114  def _checkType(self,item):
115  gen, spec = re.sub(self._reg, "",
116  str(item.__class__)).split(".")[-2:]
117  doTypes(spec,gen)
118  return spec
119 
std::vector< std::string_view > split(std::string_view, const char *)
def doTypes(spec, generic)
Definition: cfg-viewer.py:1263
def _checkType(self, item)
Definition: cfg-viewer.py:114
#define str(s)
def cfg-viewer.unscheduled._complexBase (   self,
  parentName,
  extra 
)
private

Definition at line 415 of file cfg-viewer.py.

References cfg-viewer.unscheduled._dictP, and cfg-viewer.unscheduled._parents.

Referenced by cfg-viewer.unscheduled._writeModSeqParent(), and cfg-viewer.unscheduled._writeProdConsum().

415  def _complexBase(self,parentName, extra):
416  name = parentName
417  data = self._parents[name]
418  fileName, fullfilename= data["pfile"]
419  self._allJSFiles.append(fileName)
420  all = """
421 /*
422  Base object for thing of the type:
423  It also inherits from DictParent.
424 */
425 function %(name)s(data,topLevel, nameList,indexList){
426  this.data = data;
427  this.topLevelData=topLevel;// e.g. pathNames to module names
428  this.fixedNameList = nameList; // e.g.names of paths
429 }
430 %(name)s.prototype = new %(dict)s(this.data);
431 
432 %(name)s.prototype.getKeys = function(){
433  return Object.keys(this.topLevelData)
434 }
435  """+ extra
436  with open(fullfilename, 'w') as parent:
437  parent.write(all%{"name": name, "dict": self._dictP})
438 
439 # Helper function which gets parameter details.
def _complexBase(self, parentName, extra)
Definition: cfg-viewer.py:415
def cfg-viewer.unscheduled._createObjects (   self)
private

Definition at line 195 of file cfg-viewer.py.

References cfg-viewer.unscheduled._load(), cfg-viewer.unscheduled._parents, and join().

Referenced by cfg-viewer.unscheduled._proceed().

195  def _createObjects(self):
196  base = "obj= Object.create(new %s(%s));"
197  format="""
198  function %s(%s){
199  var obj;
200  %s
201  return obj;
202  }
203  """
204  name = "data"
205  for pname,x in six.iteritems(self._parents):
206  simple = base%(pname,name)
207  filename,fullfilename= x["cfile"]
208  self._allJSFiles.append(filename)
209  if(x["simple"]):
210  paramName="modules"
211  with open(fullfilename, 'w') as setUp:
212  setUp.write(format%(x["creator"],paramName,self._load(
213  name,paramName,simple)))
214  continue
215  secName = "topL"
216  paramName=["modules","topLevel"]
217  complexOne = base%(pname,"%s,%s"%(name, secName))
218  with open(fullfilename, 'w') as setUp:
219  setUp.write(format%(x["creator"],", ".join(paramName),
220  self._load(name,paramName[0],
221  self._load(secName, paramName[1],complexOne))))
222 
def _createObjects(self)
Definition: cfg-viewer.py:195
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
def _load(self, name, param, inner)
Definition: cfg-viewer.py:224
def cfg-viewer.unscheduled._doNonSequenceType (   self,
  objs,
  globalType 
)
private

Definition at line 130 of file cfg-viewer.py.

References cfg-viewer.unscheduled._calcFilenames(), cfg-viewer.unscheduled._checkType(), cfg-viewer.unscheduled._dictP, cfg-viewer.unscheduled._mothersDaughters(), cfg-viewer.unscheduled._parents, cfg-viewer.unscheduled._saveData(), cfg-viewer.getParameters(), cfg-viewer.getParamSeqDict(), cfg-viewer.JSONFormat(), and cfg-viewer.listBase().

Referenced by cfg-viewer.unscheduled._getData().

130  def _doNonSequenceType(self,objs, globalType):
131  everything={}
132  always= types = False
133  theDataFile, fullDataFile = self._calcFilenames(globalType)
134  # For modules types can be diff
135  # so we always want to call the doTypes method
136  if(globalType =="modules"):
137  self._saveData(globalType.capitalize(),
138  self._parents[self._dictP]["creator"],
139  [theDataFile])
140  always = types = True
141  for item in objs:
142  if(always or not types):
143  spec = self._checkType(item)
144  if(not types):
145  self._saveData(spec,self._parents[self._dictP]["creator"],
146  [theDataFile])
147  types = True
148  name = self._config.label(item)
149  self._mothersDaughters(name, item)
150  if(isinstance(item,cms._Parameterizable)):
151  out = getParameters(item.parameters_())
152  elif(isinstance(item,cms._ValidatingListBase)):
153  out = listBase(item)
154  if(isinstance(item,cms._TypedParameterizable)):
155  oType = item.type_()
156  else:
157  oType =""
158  everything[name] = getParamSeqDict(out,
159  self._config.fullFilename(item),
160  self._config.type(item), oType)
161  with open(fullDataFile,'w') as dataFile:
162  dataFile.write(JSONFormat(everything))
163 
def getParameters(parameters)
Definition: cfg-viewer.py:440
def _mothersDaughters(self, name, item)
Definition: cfg-viewer.py:121
def _saveData(self, name, base, jsonfiles)
Definition: cfg-viewer.py:186
def _doNonSequenceType(self, objs, globalType)
Definition: cfg-viewer.py:130
def getParamSeqDict(params, fil, typ, oType)
Definition: cfg-viewer.py:516
def _calcFilenames(self, name)
Definition: cfg-viewer.py:165
def JSONFormat(d)
Definition: cfg-viewer.py:1266
def _checkType(self, item)
Definition: cfg-viewer.py:114
def listBase(VList)
Definition: cfg-viewer.py:471
def cfg-viewer.unscheduled._doSequenceTypes (   self,
  paths,
  namep 
)
private

Definition at line 87 of file cfg-viewer.py.

References cfg-viewer.unscheduled._calcFilenames(), cfg-viewer.unscheduled._checkType(), cfg-viewer.unscheduled._config, mps_alisetup.SetupAlignment._config, cfg-viewer.unscheduled._modSeqP, cfg-viewer.unscheduled._mothersDaughters(), cfg-viewer.unscheduled._parents, cfg-viewer.unscheduled._saveData(), cfg-viewer.getParamSeqDict(), and cfg-viewer.JSONFormat().

Referenced by cfg-viewer.unscheduled._getData().

87  def _doSequenceTypes(self,paths,namep):
88  theDataFile,fullDataFile = self._calcFilenames(namep)
89  topLevel,fullTopLevel = self._calcFilenames("top-"+namep)
90  json = [topLevel,theDataFile]
91  cap = namep.capitalize()
92  bl={}
93  types = False
94  with open(fullDataFile,'w') as data:
95  data.write("{")
96  v = visitor(data, self._config)
97  for item in paths:
98  if(not types):
99  spec = self._checkType(item)
100  self._saveData(spec,self._parents[self._modSeqP]["creator"],json)
101  types = True
102  name = self._config.label(item)
103  # Dont think we need to check for this here.
104  self._mothersDaughters(name,item)
105  key = self._config.label(item)
106  item.visit(v)
107  bl[key]= getParamSeqDict(v._finalExit(),
108  self._config.fullFilename(item), self._config.type(item), "")
109  data.write("}")
110  with open(fullTopLevel, 'w') as other:
111  other.write(JSONFormat(bl))
112 
def _mothersDaughters(self, name, item)
Definition: cfg-viewer.py:121
def _doSequenceTypes(self, paths, namep)
Definition: cfg-viewer.py:87
def _saveData(self, name, base, jsonfiles)
Definition: cfg-viewer.py:186
def getParamSeqDict(params, fil, typ, oType)
Definition: cfg-viewer.py:516
def _calcFilenames(self, name)
Definition: cfg-viewer.py:165
def JSONFormat(d)
Definition: cfg-viewer.py:1266
def _checkType(self, item)
Definition: cfg-viewer.py:114
def cfg-viewer.unscheduled._filenames (   self,
  name,
  option = "" 
)
private

Definition at line 169 of file cfg-viewer.py.

References cfg-viewer.unscheduled._theDir.

Referenced by cfg-viewer.unscheduled._calcFilenames().

169  def _filenames(self,name,option=""):
170  if(option): basicName = option%(name)
171  else: basicName = "%s.js"%(name)
172  return (basicName, "%s%s"%(self._theDir,basicName))
173 
def _filenames(self, name, option="")
Definition: cfg-viewer.py:169
def cfg-viewer.unscheduled._getData (   self,
  objs 
)
private

Definition at line 60 of file cfg-viewer.py.

References cfg-viewer.unscheduled._doNonSequenceType(), cfg-viewer.unscheduled._doSequenceTypes(), cfg-viewer.unscheduled._producersConsumers(), cfg-viewer.unscheduled._quiet, join(), and edm.print().

Referenced by cfg-viewer.unscheduled._proceed().

60  def _getData(self,objs):
61  # i will loop around objs and keep adding things which are configFolders
62  calc =[]
63  for each in objs:
64  name = self._config.label(each)
65  kids = self._config.children(each)
66  if(not kids):
67  if(not self._quiet):print(name, "is empty.")
68  continue
69  # Taking liberty of assuming all are of same type.
70  ty = type(kids[0])
71  if(ty is ConfigDataAccessor.ConfigFolder):
72  objs.extend(kids)
73  else:
74  if(not self._quiet):print("computing %s.."%(name))
75  if(isinstance(kids[0], seq._ModuleSequenceType)):
76  # e.g.it's a path, sequence or endpath
77  self._doSequenceTypes(kids,name)
78  else:
79  # e.g. it's a pset etc.
80  self._doNonSequenceType(kids,name)
81  calc.append(name)
82  # now i will print out producers/consumers.
83  if(self._quiet):print("calculated: %s."%(", ".join(calc)))
84  self._producersConsumers()
85 
def _doSequenceTypes(self, paths, namep)
Definition: cfg-viewer.py:87
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def _getData(self, objs)
Definition: cfg-viewer.py:60
def _doNonSequenceType(self, objs, globalType)
Definition: cfg-viewer.py:130
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
def _producersConsumers(self)
Definition: cfg-viewer.py:175
def cfg-viewer.unscheduled._load (   self,
  name,
  param,
  inner 
)
private

Definition at line 224 of file cfg-viewer.py.

Referenced by cfg-viewer.unscheduled._createObjects().

224  def _load(self,name,param,inner):
225  return"""
226  loadJSON(%s).done(function(%s){\n%s\n});
227  """%(param,name,inner)
228 
def _load(self, name, param, inner)
Definition: cfg-viewer.py:224
def cfg-viewer.unscheduled._mothersDaughters (   self,
  name,
  item 
)
private

Definition at line 121 of file cfg-viewer.py.

References cfg-viewer.unscheduled._daughter.

Referenced by cfg-viewer.unscheduled._doNonSequenceType(), and cfg-viewer.unscheduled._doSequenceTypes().

121  def _mothersDaughters(self,name, item):
122  mo =self._config.motherRelations(item)
123  dau = self._config.daughterRelations(item)
124  if(mo):
125  self._mother[name] = [self._config.label(i) for i in mo]
126  if(dau):
127  self._daughter[name] = [self._config.label(i) for i in dau]
128 
def _mothersDaughters(self, name, item)
Definition: cfg-viewer.py:121
def cfg-viewer.unscheduled._proceed (   self,
  fileName 
)
private

Definition at line 37 of file cfg-viewer.py.

References cfg-viewer.unscheduled._allJSFiles, cfg-viewer.unscheduled._createObjects(), SeedingNode< DATA >._data, SeedingNode< TrackingLayer >._data, python.XML2Python.DataNode._data, data_sources.node._data, XML2Python.DataNode._data, data_sources.json_file._data, L1TMuon::TTTriggerPrimitive._data, data_sources.sqlite_schema._data, data_sources.json_data_node._data, DTBtiTrig._data, data_sources.json_list._data, DTTracoTrig._data, data_sources.json_dict._data, data_sources.json_basic._data, BitArray< 15 >._data, DTTFBitArray< N >._data, BitArray< N >._data, BitArray< 32 >._data, BitArray< DTConfigTraco::NSTEPL+2 >._data, BitArray< 24 >._data, BitArray< 16 >._data, BitArray< DTConfigTSTheta::NCELLTH >._data, BitArray< 7 >._data, BitArray< 9 >._data, DTTFBitArray< 8 >._data, DTTFBitArray< 10 >._data, DTTFBitArray< 12 >._data, DTTFBitArray< 5 >._data, BitArray< 8 >._data, cfg-viewer.unscheduled._getData(), cfg-viewer.unscheduled._helperDir, cfg-viewer.unscheduled._html, cfg-viewer.unscheduled._theDir, cfg-viewer.unscheduled._type, PGeometricDet::Item._type, python.Handle._type, HistoParams< T >._type, hcaldqm::quantity::DetectorQuantity._type, Vispa.Gui.PortConnection.PointToPointConnection._type, hcaldqm::quantity::TrigTowerQuantity._type, MELaserPrim._type, RPCCompDetId._type, HistoParams< TH2F >._type, TrackerGeometryCompare._type, HistoParams< TProfile2D >._type, hcaldqm::quantity::ElectronicsQuantity._type, hcaldqm::quantity::ValueQuantity._type, SequenceTypes.ExpandVisitor._type, cfg-viewer.unscheduled._writeDictParent(), cfg-viewer.unscheduled._writeModSeqParent(), cfg-viewer.unscheduled._writeProdConsum(), edm.print(), and cms::dd.split().

37  def _proceed(self, fileName):
38  #self._filename= ""
39  topObjs = self._config.topLevelObjects()
40  if(len(topObjs)):
41  self._getData(topObjs)
42  ty = "genericTypes"
43  with open(self._type, 'w') as f:
44  f.write("var %s=%s"%(ty,genericTypes))
45  self._createObjects()
46  self._writeDictParent(ty)
47  self._writeModSeqParent()
48  self._writeProdConsum()
49  fN = fileName.split("./")[-1].split(".")[0]
50  JS = ["%s%s"%(self._helperDir,x)for x in self._allJSFiles]
51  html(self._html,JS,self._data, self._theDir, self._helperDir,
52  self._config.process().name_(), fN)
53 
54  return True
55  else:
56  print("---Nothing found for file %s."\
57  " No computation done.---"%(fileName))
58  return False
59 
std::vector< std::string_view > split(std::string_view, const char *)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def _writeProdConsum(self)
Definition: cfg-viewer.py:376
def _createObjects(self)
Definition: cfg-viewer.py:195
def _getData(self, objs)
Definition: cfg-viewer.py:60
def _writeModSeqParent(self)
Definition: cfg-viewer.py:350
def _writeDictParent(self, typeName)
Definition: cfg-viewer.py:230
def _proceed(self, fileName)
Definition: cfg-viewer.py:37
def cfg-viewer.unscheduled._producersConsumers (   self)
private

Definition at line 175 of file cfg-viewer.py.

References cfg-viewer.unscheduled._calcFilenames(), cfg-viewer.unscheduled._daughter, cfg-viewer.unscheduled._parents, cfg-viewer.unscheduled._prodConsP, cfg-viewer.unscheduled._saveData(), and cfg-viewer.JSONFormat().

Referenced by cfg-viewer.unscheduled._getData().

176  if(not self._mother and not self._daughter):
177  return
178  for name,theDict in six.iteritems({"producer":self._mother,
179  "consumer":self._daughter}):
180  thedataFile , fulldataFile = self._calcFilenames(name)
181  self._saveData(name.capitalize(),
182  self._parents[self._prodConsP]["creator"],
183  [thedataFile,self._calcFilenames("modules")[0]])
184  with open(fulldataFile,'w') as moth:
185  moth.write(JSONFormat(theDict))
def _saveData(self, name, base, jsonfiles)
Definition: cfg-viewer.py:186
def _calcFilenames(self, name)
Definition: cfg-viewer.py:165
def JSONFormat(d)
Definition: cfg-viewer.py:1266
def _producersConsumers(self)
Definition: cfg-viewer.py:175
def cfg-viewer.unscheduled._saveData (   self,
  name,
  base,
  jsonfiles 
)
private

Definition at line 186 of file cfg-viewer.py.

References SeedingNode< DATA >._data, SeedingNode< TrackingLayer >._data, python.XML2Python.DataNode._data, data_sources.node._data, XML2Python.DataNode._data, data_sources.json_file._data, L1TMuon::TTTriggerPrimitive._data, data_sources.sqlite_schema._data, data_sources.json_data_node._data, DTBtiTrig._data, data_sources.json_list._data, DTTracoTrig._data, data_sources.json_dict._data, data_sources.json_basic._data, BitArray< 32 >._data, BitArray< N >._data, BitArray< DTConfigTraco::NSTEPL+2 >._data, DTTFBitArray< 10 >._data, BitArray< DTConfigTSTheta::NCELLTH >._data, BitArray< 9 >._data, BitArray< 24 >._data, DTTFBitArray< 12 >._data, DTTFBitArray< N >._data, DTTFBitArray< 5 >._data, BitArray< 8 >._data, BitArray< 16 >._data, BitArray< 7 >._data, DTTFBitArray< 8 >._data, BitArray< 15 >._data, cfg-viewer.unscheduled._helperDir, and join().

Referenced by cfg-viewer.unscheduled._doNonSequenceType(), cfg-viewer.unscheduled._doSequenceTypes(), and cfg-viewer.unscheduled._producersConsumers().

186  def _saveData(self,name,base,jsonfiles):
187  jsonfiles = " ".join(["%s%s"%(self._helperDir,x)for x in jsonfiles])
188  temp={}
189  temp["data-base"] = base
190  temp["data-files"] = jsonfiles
191  self._data[name] = temp
192 
def _saveData(self, name, base, jsonfiles)
Definition: cfg-viewer.py:186
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
def cfg-viewer.unscheduled._writeDictParent (   self,
  typeName 
)
private

Definition at line 230 of file cfg-viewer.py.

References cfg-viewer.unscheduled._dictP, and cfg-viewer.unscheduled._parents.

Referenced by cfg-viewer.unscheduled._proceed().

230  def _writeDictParent(self, typeName):
231  exVar ='this.%(key)sKey= "%(key)s";'
232  exFunc ="""
233 /**
234  * Gives the %(key)s
235  * @param {String} the key to the dictionary.
236  * @returns {String || Integer} result from dictionary if found else 0.
237  */
238 %(name)s.prototype.get%(key)s = function(key){
239  return this.getFeature(key,this.%(key)sKey);
240 }
241  """
242  search = """%(name)s.prototype.search%(key)s = function(reg,term,replce){
243  return this.generalSearch(reg,term,replce,this.%(key)sKey);
244 } """
245  extra= """
246  /**
247  /**
248 * Uses the list of parents names to go further into
249 * the lists in the dictionry, and give the last parents children.
250 * @param {Array} the names of parents to look through.
251 * First parent should be a key to the dictionary.
252 * @param {Integer} the index where the elusive parameter is. Needed incase
253 * we have a list with muultiple parameters of the same name.
254 *
255 * @returns {Array} the resulting children from the last parent.
256 */
257 DictParent.prototype.getInnerParams = function(parents, index){
258  var currentList = this.data[parents[0]][this.%(key)sKey];
259  var targetList=[]
260  var siblingsOfTarget=[]
261  for(var i=1; i < parents.length;i++){
262  for(var p=0; p < currentList.length;p++){
263  if(currentList[p][0]==parents[i]){
264  targetList = currentList[p]
265  siblingsOfTarget=currentList
266  var found = targetList[1];
267  break;
268  }
269  }
270  currentList = found;
271  }
272  if(p != index)targetList=siblingsOfTarget[index]
273  return targetList;
274 }
275  """
276  functs=""
277  variables =""
278  name = self._dictP
279  data = self._parents[name]
280  fileName, fullfileName= data["pfile"]
281  for feature in dictFeatures:
282  d = {"key": feature, "name": name}
283  variables +=exVar%d
284  functs +=exFunc%d
285  if(feature == "Parameters"):
286  functs +=extra%d
287  else:
288  functs += search%d
289  self._allJSFiles.append(fileName)
290  with open(fullfileName, 'w') as parent:
291  parent.write("""
292 /*
293  Base Object for dictionaries.
294  To use, create a dictParent obj,
295  then use Object.create to create a new obj
296  then you can change some variables/add functions
297  and have the inherited functions.
298 */
299 function %(name)s(data){
300  this.data=data;
301  %(theVars)s
302 }
303 /**
304  * Finds the desired feature from a dictionary.
305 * @param {String} the key to the dictionary.
306 * @param {String} the feature we want from the dictionary.
307 * @returns {String || Integer} result from dictionary if found else 0.
308 */
309 %(name)s.prototype.getFeature = function(key, feature){
310  var temp = this.data[key];
311  if(temp) return temp[feature];
312  else return 0;
313 }
314 DictParent.prototype.getData = function(){
315  return [this.data];
316 }
317 %(getterFunctions)s
318 
319 /**
320  * Gives the keys from desired dictionary.
321 * @returns {Array} all keys from the dictionary.
322 */
323 %(name)s.prototype.getKeys = function(){
324  return Object.keys(this.data);
325 }
326 %(name)s.prototype.generalSearch = function(reg,term,repl,feature, d){
327  d = d || this.data;
328  var matches ={}
329  for (var key in d){
330  var x= d[key][feature]
331  if(x.indexOf(term)>-1){
332  matches[key] = x.replace(reg,repl)
333  }
334  }
335  return matches;
336 }
337 
338 /**
339  * Gives the generic type for a given type.
340  * @param {String} type
341  * @returns {String} the generic type
342  */
343 function getGenericType(type){
344  return %(gen)s[type];
345 }
346  """%{"theVars":variables,"getterFunctions":functs,
347  "gen": typeName, "name":name})
348 
def _writeDictParent(self, typeName)
Definition: cfg-viewer.py:230
def cfg-viewer.unscheduled._writeModSeqParent (   self)
private

Definition at line 350 of file cfg-viewer.py.

References cfg-viewer.unscheduled._complexBase(), and cfg-viewer.unscheduled._modSeqP.

Referenced by cfg-viewer.unscheduled._proceed().

351  f = """
352 /**
353  * Gives the direct children
354  * @param {String} a path name
355  * @returns {Array} list of names of the the children.
356  */
357 %(name)s.prototype.getModules = function(name){
358  return this.topLevelData[name][this.ParametersKey];
359 }
360 %(name)s.prototype.getTopFile = function(key){
361  return this.topLevelData[key][this.FileKey];
362 }
363 %(name)s.prototype.getData = function(){
364  return [this.topLevelData, this.data];
365 }
366 %(name)s.prototype.searchType = function(reg,term,replce){
367  return this.generalSearch(reg,term,replce,this.TypeKey, this.topLevelData);
368 }
369 %(name)s.prototype.searchFile = function(reg,term,replce){
370  return this.generalSearch(reg,term,replce,this.FileKey, this.topLevelData);
371 }
372 """
373  self._complexBase(self._modSeqP, f)
374 
def _complexBase(self, parentName, extra)
Definition: cfg-viewer.py:415
def _writeModSeqParent(self)
Definition: cfg-viewer.py:350
def cfg-viewer.unscheduled._writeProdConsum (   self)
private

Definition at line 376 of file cfg-viewer.py.

References cfg-viewer.unscheduled._complexBase(), and cfg-viewer.unscheduled._prodConsP.

Referenced by cfg-viewer.unscheduled._proceed().

376  def _writeProdConsum(self):
377  f= """
378 /**
379  * Gives the direct children
380  * @param {String} a path name
381  * @returns {Array} list of names of the the children.
382  */
383 %(name)s.prototype.getModules = function(name){
384  return this.topLevelData[name];
385 }
386 %(name)s.prototype.getTopFile = function(key){
387  return this.getFile(key);
388 }
389 %(name)s.prototype.getData = function(){
390  return [this.topLevelData, this.data];
391 }
392 // Producer and consumer have different structure to rest.
393 // Dont have file and type with them..
394 // to get file and type we need to take each name,
395 //look up the moduledata and find matches.
396 %(name)s.prototype.generalSearch = function(reg,term,repl, feature){
397  var matches ={}
398  for (var key in this.topLevelData){
399  var x = this.data[key][feature]
400  if(x.indexOf(term)>-1){
401  matches[key] = x.replace(reg,repl)
402  }
403  }
404  return matches;
405 }
406 %(name)s.prototype.typeSearch = function(reg,term,replce){
407  return this.generalSearch(reg,term,replce,this.TypeKey);
408 }
409 %(name)s.prototype.fileSearch = function(reg,term,replce){
410  return this.generalSearch(reg,term,replce,this.FileKey);
411 }
412  """
413  self._complexBase(self._prodConsP, f)
414 
def _writeProdConsum(self)
Definition: cfg-viewer.py:376
def _complexBase(self, parentName, extra)
Definition: cfg-viewer.py:415

Member Data Documentation

cfg-viewer.unscheduled._allJSFiles
private

Definition at line 32 of file cfg-viewer.py.

Referenced by cfg-viewer.unscheduled._proceed().

cfg-viewer.unscheduled._computed
private

Definition at line 35 of file cfg-viewer.py.

cfg-viewer.unscheduled._config
private

Definition at line 33 of file cfg-viewer.py.

Referenced by cfg-viewer.unscheduled._doSequenceTypes().

cfg-viewer.unscheduled._daughter
private
cfg-viewer.unscheduled._dictP
private
cfg-viewer.unscheduled._genericTypes
private

Definition at line 19 of file cfg-viewer.py.

cfg-viewer.unscheduled._helperDir
private
cfg-viewer.unscheduled._html
private

Definition at line 12 of file cfg-viewer.py.

Referenced by cfg-viewer.unscheduled._proceed().

cfg-viewer.unscheduled._modSeqP
private
cfg-viewer.unscheduled._parents
private
cfg-viewer.unscheduled._prodConsP
private
cfg-viewer.unscheduled._quiet
private

Definition at line 14 of file cfg-viewer.py.

Referenced by cfg-viewer.unscheduled._getData().

cfg-viewer.unscheduled._reg
private

Definition at line 18 of file cfg-viewer.py.

Referenced by cfg-viewer.unscheduled._checkType(), and cfg-viewer.visitor._getType().

cfg-viewer.unscheduled._theDir
private
cfg-viewer.unscheduled._type
private

Definition at line 31 of file cfg-viewer.py.

Referenced by cfg-viewer.unscheduled._proceed().