Adds an object to the registry, returning the object's ID.
(cls, obj: ObjWithId)
| 25 | |
| 26 | @classmethod |
| 27 | def add(cls, obj: ObjWithId) -> str: |
| 28 | """Adds an object to the registry, returning the object's ID.""" |
| 29 | object_id = obj.id() if callable(obj.id) else obj.id |
| 30 | cls.registry[object_id] = obj |
| 31 | return object_id |
| 32 | |
| 33 | @classmethod |
| 34 | def get(cls, obj_id: str) -> Optional[ObjWithId]: |
no test coverage detected