def adoptOrphanParams(self): for key,val in self._values.iteritems(): if not isSimObjectVector(val) and isSimObjectSequence(val): # need to convert raw SimObject sequences to # SimObjectVector class so we can call has_parent() val = SimObjectVector(val) self._values[key] = val if isSimObjectOrVector(val) and not val.has_parent(): warn("%s adopting orphan SimObject param '%s'", self, key) self.add_child(key, val)
def adoptOrphanParams(self): for key, val in self._values.iteritems(): if not isSimObjectVector(val) and isSimObjectSequence(val): # need to convert raw SimObject sequences to # SimObjectVector class so we can call has_parent() val = SimObjectVector(val) self._values[key] = val if isSimObjectOrVector(val) and not val.has_parent(): warn("%s adopting orphan SimObject param '%s'", self, key) self.add_child(key, val)
def tryAsSimObjectOrVector(value): if isSimObjectOrVector(value): return value if isSimObjectSequence(value): return SimObjectVector(value) return None