Пример #1
0
 def configValue(self, options=PrintOptions()):
     result = self.__moduleLabel
     if self.__data != "":
         result += ':' + self.__data
     if result == "":
         result = '\"\"'
     return result
Пример #2
0
 def testSequences(self):
     m = EDProducer("MProducer")
     n = EDProducer("NProducer")
     m.setLabel("m")
     n.setLabel("n")
     s1 = Sequence(m*n)
     options = PrintOptions()
Пример #3
0
 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(":", "\",\"")
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
 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)'
Пример #7
0
 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
Пример #8
0
 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
Пример #9
0
 def configValue(self, options=PrintOptions()):
     return string.formatValueForConfig(self.value())
Пример #10
0
        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()
)
""")
Пример #11
0
 def dumpSequencePython(self, options=PrintOptions()):
     return "process." + self.type_()
Пример #12
0
 def dumpPython(self, options=PrintOptions()):
     return self.pythonTypeName() + "(\n" + _Parameterizable.dumpPython(
         self, options) + options.indentation() + ")"
Пример #13
0
 def dumpPython(self, options=PrintOptions()):
     return _TypedParameterizable.dumpPython(self, options)
Пример #14
0
 def configValue(self, options=PrintOptions()):
     return self.dumpConfig(options)
Пример #15
0
 def pythonValue(self, options=PrintOptions()):
     return self.configValue(options)
Пример #16
0
 def pythonValue(self, options=PrintOptions()):
     return str(self.__run) + ', ' + str(
         self.__luminosityBlock) + ', ' + str(self.__event)
Пример #17
0
 def pythonValue(self, options=PrintOptions()):
     return str(self.__start) + ', ' + str(self.__startLumi) + ', ' + str(self.__startSub) + ', ' \
            + str(self.__end)  + ', ' + str(self.__endLumi) + ', ' + str(self.__endSub)
Пример #18
0
 def pythonValue(self, options=PrintOptions()):
     return str(self.__run) + ', ' + str(self.__block)