Public Member Functions | |
def | __init__ |
def | dumpPython |
def | setValue |
Public Attributes | |
multiplesAllowed | |
value | |
Private Member Functions | |
def | _pythonValue |
Used to 'set' an unknown type of value from a Replace node
Definition at line 1050 of file parseConfig.py.
def parseConfig::_ReplaceSetter::__init__ | ( | self, | ||
value | ||||
) |
Reimplemented in parseConfig::_VPSetReplaceSetter, parseConfig::_PSetReplaceSetter, parseConfig::_SimpleListTypeExtendSetter, parseConfig::_SimpleListTypeAppendSetter, parseConfig::_VPSetExtendSetter, parseConfig::_VPSetAppendSetter, and parseConfig::_IncrementFromVariableSetter.
Definition at line 1052 of file parseConfig.py.
01052 : 01053 self.value = value 01054 #one one replace of this type is allowed per configuration 01055 self.multiplesAllowed = False def setValue(self,obj,attr):
def parseConfig::_ReplaceSetter::_pythonValue | ( | value, | ||
options | ||||
) | [private] |
Reimplemented in parseConfig::_ParameterReplaceSetter.
Definition at line 1069 of file parseConfig.py.
01069 : 01070 #if it's a number, we don't want quotes 01071 result = str(value) 01072 nodots = result.replace('.','') 01073 if nodots.isdigit() or (len(nodots) > 0 and nodots[0] == '-') or (len(nodots) > 1 and (nodots[0:2] == '0x' or nodots[0:2] == '0X')): 01074 pass 01075 elif result == 'true': 01076 result = 'True' 01077 elif result == 'false': 01078 result = 'False' 01079 elif len(value) == 0: 01080 result = repr(value) 01081 elif result[0] == '[': 01082 l = eval(result) 01083 isVInputTag = False 01084 result = '' 01085 indented = False 01086 for i, x in enumerate(l): 01087 if i == 0: 01088 if hasattr(x, "_nPerLine"): 01089 nPerLine = x._nPerLine 01090 else: 01091 nPerLine = 5 01092 else: 01093 result += ', ' 01094 if i % nPerLine == 0: 01095 if not indented: 01096 indented = True 01097 options.indent() 01098 result += '\n'+options.indentation() 01099 element = _ReplaceSetter._pythonValue(x, options) 01100 if element.find('InputTag') != -1: 01101 isVInputTag = True 01102 result += element 01103 if indented: 01104 options.unindent() 01105 if isVInputTag: 01106 result = "cms.VInputTag("+result+")" 01107 else: 01108 result = "["+result+"]" 01109 # some frontier address strings have colons and slashes 01110 #elif result.find(':') != -1 and result.find('/') == -1: 01111 # result = repr(cms.InputTag._valueFromString(result)) 01112 else: 01113 # need the quotes 01114 result = repr(value) 01115 return result 01116 01117 01118 class _ParameterReplaceSetter(_ReplaceSetter):
def parseConfig::_ReplaceSetter::dumpPython | ( | self, | ||
options | ||||
) |
Reimplemented in parseConfig::_SimpleListTypeExtendSetter, parseConfig::_SimpleListTypeAppendSetter, parseConfig::_VPSetExtendSetter, parseConfig::_VPSetAppendSetter, and parseConfig::_IncrementFromVariableSetter.
Definition at line 1065 of file parseConfig.py.
01065 : 01066 # FIXME not really a repr, because of the = sign 01067 return " = "+self._pythonValue(self.value, options) 01068 @staticmethod def _pythonValue(value, options):
def parseConfig::_ReplaceSetter::setValue | ( | self, | ||
obj, | ||||
attr | ||||
) |
Reimplemented in parseConfig::_ParameterReplaceSetter, parseConfig::_SimpleListTypeExtendSetter, parseConfig::_SimpleListTypeAppendSetter, parseConfig::_VPSetExtendSetter, parseConfig::_VPSetAppendSetter, and parseConfig::_IncrementFromVariableSetter.
Definition at line 1056 of file parseConfig.py.
01056 : 01057 theAt = getattr(obj,attr) 01058 #want to change the value, not the actual parameter 01059 #setattr(obj,attr,theAt._valueFromString(self.value).value()) 01060 #by replacing the actual parameter we isolate ourselves from 01061 # 'replace' commands done by others on shared using blocks 01062 v=theAt._valueFromString(self.value) 01063 v.setIsTracked(theAt.isTracked()) 01064 setattr(obj,attr,v) def dumpPython(self, options):
Reimplemented in parseConfig::_SimpleListTypeExtendSetter, parseConfig::_SimpleListTypeAppendSetter, parseConfig::_VPSetExtendSetter, parseConfig::_VPSetAppendSetter, and parseConfig::_IncrementFromVariableSetter.
Definition at line 1055 of file parseConfig.py.
Reimplemented in parseConfig::_IncrementFromVariableSetter.
Definition at line 1053 of file parseConfig.py.