def append(self, item): if type(item) is SlotProperties: try: s = Slot(item) if self._cb is not None: s.set_conn_update_callback(self._cb) self[item.name] = s if s.is_shared: self._sort_shared_slots() except Exception as e: rospy.logerr(e) raise e elif type(item) is GroupProperties: try: hostnames = item.hosts if len(item.hosts) == 0: hostnames = rospy.get_param("~default_group_hosts", []) any_shared = False for h in hostnames: rep = item.representative s = Slot(rep, h) if self._cb is not None: s.set_conn_update_callback(self._cb) self[s.name] = s if s.is_shared is True: any_shared = True if any_shared is True: self._sort_shared_slots() except Exception as e: rospy.logerr(e) raise e else: raise TypeError("Invalid item type ('%s')" % type(item))