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 9 of file cfg-viewer.py.

Constructor & Destructor Documentation

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

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

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

Member Function Documentation

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

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

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

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

113  def _checkType(self,item):
114  gen, spec = re.sub(self._reg, "",
115  str(item.__class__)).split(".")[-2:]
116  doTypes(spec,gen)
117  return spec
118 
def doTypes(spec, generic)
Definition: cfg-viewer.py:1262
def _checkType(self, item)
Definition: cfg-viewer.py:113
#define str(s)
double split
Definition: MVATrainer.cc:139
def cfg-viewer.unscheduled._complexBase (   self,
  parentName,
  extra 
)
private

Definition at line 414 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().

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

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

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

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

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

Definition at line 129 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().

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

Definition at line 86 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().

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

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

References cfg-viewer.unscheduled._theDir.

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

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

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

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

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

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

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

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

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

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

References cfg-viewer.unscheduled._daughter.

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

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

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

References cfg-viewer.unscheduled._allJSFiles, cfg-viewer.unscheduled._createObjects(), SeedingNode< DATA >._data, python.XML2Python.DataNode._data, SeedingNode< TrackingLayer >._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, DTTFBitArray< 5 >._data, DTTFBitArray< N >._data, BitArray< 8 >._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, BitArray< 15 >._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, Vispa.Gui.PortConnection.PointToPointConnection._type, MELaserPrim._type, hcaldqm::quantity::DetectorQuantity._type, hcaldqm::quantity::TrigTowerQuantity._type, RPCCompDetId._type, HistoParams< TH2F >._type, TrackerGeometryCompare._type, HistoParams< TProfile2D >._type, hcaldqm::quantity::ValueQuantity._type, hcaldqm::quantity::ElectronicsQuantity._type, SequenceTypes.ExpandVisitor._type, cfg-viewer.unscheduled._writeDictParent(), cfg-viewer.unscheduled._writeModSeqParent(), cfg-viewer.unscheduled._writeProdConsum(), and split.

36  def _proceed(self, fileName):
37  #self._filename= ""
38  topObjs = self._config.topLevelObjects()
39  if(len(topObjs)):
40  self._getData(topObjs)
41  ty = "genericTypes"
42  with open(self._type, 'w') as f:
43  f.write("var %s=%s"%(ty,genericTypes))
44  self._createObjects()
45  self._writeDictParent(ty)
46  self._writeModSeqParent()
47  self._writeProdConsum()
48  fN = fileName.split("./")[-1].split(".")[0]
49  JS = ["%s%s"%(self._helperDir,x)for x in self._allJSFiles]
50  html(self._html,JS,self._data, self._theDir, self._helperDir,
51  self._config.process().name_(), fN)
52 
53  return True
54  else:
55  print "---Nothing found for file %s."\
56  " No computation done.---"%(fileName)
57  return False
58 
def _writeProdConsum(self)
Definition: cfg-viewer.py:375
def _createObjects(self)
Definition: cfg-viewer.py:194
def _getData(self, objs)
Definition: cfg-viewer.py:59
def _writeModSeqParent(self)
Definition: cfg-viewer.py:349
double split
Definition: MVATrainer.cc:139
def _writeDictParent(self, typeName)
Definition: cfg-viewer.py:229
def _proceed(self, fileName)
Definition: cfg-viewer.py:36
def cfg-viewer.unscheduled._producersConsumers (   self)
private

Definition at line 174 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().

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

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

References SeedingNode< DATA >._data, python.XML2Python.DataNode._data, SeedingNode< TrackingLayer >._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< 5 >._data, DTTFBitArray< 10 >._data, BitArray< 9 >._data, BitArray< 24 >._data, DTTFBitArray< 12 >._data, DTTFBitArray< N >._data, BitArray< 8 >._data, BitArray< 16 >._data, BitArray< DTConfigTSTheta::NCELLTH >._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().

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

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

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

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

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

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

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

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

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

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

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

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

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

Member Data Documentation

cfg-viewer.unscheduled._allJSFiles
private

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

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

cfg-viewer.unscheduled._computed
private

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

cfg-viewer.unscheduled._config
private

Definition at line 32 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 18 of file cfg-viewer.py.

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

Definition at line 11 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 13 of file cfg-viewer.py.

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

cfg-viewer.unscheduled._reg
private

Definition at line 17 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 30 of file cfg-viewer.py.

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