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

Constructor & Destructor Documentation

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

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

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

Member Function Documentation

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

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

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

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

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

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

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

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

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

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

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

Definition at line 128 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(), reco.if(), cfg-viewer.JSONFormat(), and cfg-viewer.listBase().

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

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

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

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

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

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

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

References cfg-viewer.unscheduled._theDir, and reco.if().

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

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

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

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

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

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

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

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

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

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

References cfg-viewer.unscheduled._daughter, and reco.if().

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

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

Definition at line 35 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, 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, 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(), reco.if(), and split.

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

Definition at line 173 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(), reco.if(), and cfg-viewer.JSONFormat().

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

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

Definition at line 184 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, 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< DTConfigTraco::NSTEPL+2 >._data, BitArray< 32 >._data, BitArray< 24 >._data, DTTFBitArray< 5 >._data, BitArray< 7 >._data, DTTFBitArray< 10 >._data, BitArray< 15 >._data, DTTFBitArray< 12 >._data, DTTFBitArray< N >._data, BitArray< N >._data, BitArray< 9 >._data, BitArray< DTConfigTSTheta::NCELLTH >._data, BitArray< 8 >._data, DTTFBitArray< 8 >._data, BitArray< 16 >._data, cfg-viewer.unscheduled._helperDir, and join().

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

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

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

References cfg-viewer.unscheduled._dictP, cfg-viewer.unscheduled._parents, and reco.if().

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

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

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

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

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

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

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

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

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

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

Member Data Documentation

cfg-viewer.unscheduled._allJSFiles
private

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

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

cfg-viewer.unscheduled._computed
private

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

cfg-viewer.unscheduled._config
private

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

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

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

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

cfg-viewer.unscheduled._reg
private

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

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