def configValue(self, options=PrintOptions()): result = self.__moduleLabel if self.__data != "": result += ':' + self.__data if result == "": result = '\"\"' return result
def testSequences(self): m = EDProducer("MProducer") n = EDProducer("NProducer") m.setLabel("m") n.setLabel("n") s1 = Sequence(m*n) options = PrintOptions()
def pythonValue(self, options=PrintOptions()): cfgValue = self.configValue(options) # empty strings already have quotes if cfgValue == '\"\"': return cfgValue colonedValue = "\"" + cfgValue + "\"" # change label:instance:process to "label","instance","process" return colonedValue.replace(":", "\",\"")
def configValue(self, options=PrintOptions()): config = '{ \n' for name in self.parameterNames_(): param = getattr(self,name) options.indent() config+=options.indentation()+param.configTypeName()+' '+name+' = '+param.configValue(options)+'\n' options.unindent() config += options.indentation()+'}\n' return config
def configValue(self, options=PrintOptions()): result = self.__moduleLabel if self.__productInstance != "" or self.__processName != "": result += ':' + self.__productInstance if self.__processName != "": result += ':' + self.__processName if result == "": result = '\"\"' return result
def dumpPython(self, options=PrintOptions()): resultList = ['cms.EDAlias('] separator = "" for name in self.parameterNames_(): resultList[-1] = resultList[-1] + separator separator="," param = self.__dict__[name] options.indent() resultList.append(options.indentation()+name+' = '+param.dumpPython(options)) options.unindent() return '\n'.join(resultList)+'\n)'
def dumpPython(self, options=PrintOptions()): # Note that if anyone uses the generic SwitchProducer instead # of a derived-one, the information on the functions for the # producer decision is lost result = "%s(" % self.__class__.__name__ # not including cms. since the deriving classes are not in cms "namespace" options.indent() for resource in sorted(self.parameterNames_()): result += "\n" + options.indentation() + resource + " = " + getattr(self, resource).dumpPython(options).rstrip() + "," if result[-1] == ",": result = result.rstrip(",") options.unindent() result += "\n)\n" return result
def dumpPythonAs(self, label, options=PrintOptions()): result = options.indentation() basename = self._targetLabel if basename == '': basename = self.type_() if options.isCfg: # do either type or label result += 'process.prefer("'+basename+'"' if self.parameterNames_(): result += ",\n"+_Parameterizable.dumpPython(self,options)+options.indentation() result +=')\n' else: # use the base class Module result += 'es_prefer_'+basename+' = cms.ESPrefer("'+self.type_()+'"' if self._targetLabel != '': result += ',"'+self._targetLabel+'"' if self.parameterNames_(): result += ",\n"+_Parameterizable.dumpPython(self,options)+options.indentation() result += ')\n' return result
def configValue(self, options=PrintOptions()): return string.formatValueForConfig(self.value())
def testESPrefer(self): juicer = ESPrefer("JuiceProducer") options = PrintOptions() options.isCfg = True self.assertEqual(juicer.dumpPythonAs("juicer", options), "process.prefer(\"JuiceProducer\")\n") options.isCfg = False self.assertEqual(juicer.dumpPythonAs("juicer", options), "es_prefer_JuiceProducer = cms.ESPrefer(\"JuiceProducer\")\n") juicer = ESPrefer("JuiceProducer","juicer") options = PrintOptions() options.isCfg = True self.assertEqual(juicer.dumpPythonAs("juicer", options), 'process.prefer("juicer")\n') options.isCfg = False self.assertEqual(juicer.dumpPythonAs("juicer", options), 'es_prefer_juicer = cms.ESPrefer("JuiceProducer","juicer")\n') juicer = ESPrefer("JuiceProducer",fooRcd=vstring()) self.assertEqual(juicer.dumpConfig(options), """JuiceProducer { vstring fooRcd = { } } """) options = PrintOptions() options.isCfg = True self.assertEqual(juicer.dumpPythonAs("juicer"), """process.prefer("JuiceProducer", fooRcd = cms.vstring() ) """) options.isCfg = False self.assertEqual(juicer.dumpPythonAs("juicer", options), """es_prefer_JuiceProducer = cms.ESPrefer("JuiceProducer", fooRcd = cms.vstring() ) """)
def dumpSequencePython(self, options=PrintOptions()): return "process." + self.type_()
def dumpPython(self, options=PrintOptions()): return self.pythonTypeName() + "(\n" + _Parameterizable.dumpPython( self, options) + options.indentation() + ")"
def dumpPython(self, options=PrintOptions()): return _TypedParameterizable.dumpPython(self, options)
def configValue(self, options=PrintOptions()): return self.dumpConfig(options)
def pythonValue(self, options=PrintOptions()): return self.configValue(options)
def pythonValue(self, options=PrintOptions()): return str(self.__run) + ', ' + str( self.__luminosityBlock) + ', ' + str(self.__event)
def pythonValue(self, options=PrintOptions()): return str(self.__start) + ', ' + str(self.__startLumi) + ', ' + str(self.__startSub) + ', ' \ + str(self.__end) + ', ' + str(self.__endLumi) + ', ' + str(self.__endSub)
def pythonValue(self, options=PrintOptions()): return str(self.__run) + ', ' + str(self.__block)