raise RuntimeError(f"Subject {subject} with state {str(subject.state)} resulted in an empty string as key (to use in dict/hash).")
15
if key in self.datapoints_objects:
16
raise RuntimeError(f"Attempted to register a new Datapoints object at the existing key '{key}'.")
17
self.datapoints_objects[key] = datapoints_object
18
self._last_key = key
19
20
@property
21
def state(self):
22
return self._last_key
23
24
@property
25
def datapoints(self):
26
try:
27
return self.datapoints_objects[self._last_key]
28
except KeyError as e:
29
print(f"{e}. Requested datapoints with id '{self._last_key}', but was not found in registered [{', '.join(_ for _ in self.datapoints_objects.keys())}]")