From 507aeac8a5be9891208569856e56cfc8fe007cdd Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 7 Feb 2024 23:43:22 +1100 Subject: [PATCH] tidy(nodes): remove object serializer on_saved It's unused. --- .../services/object_serializer/object_serializer_base.py | 9 --------- .../object_serializer/object_serializer_forward_cache.py | 1 - 2 files changed, 10 deletions(-) diff --git a/invokeai/app/services/object_serializer/object_serializer_base.py b/invokeai/app/services/object_serializer/object_serializer_base.py index b01a641d8f..ff19b4a039 100644 --- a/invokeai/app/services/object_serializer/object_serializer_base.py +++ b/invokeai/app/services/object_serializer/object_serializer_base.py @@ -8,7 +8,6 @@ class ObjectSerializerBase(ABC, Generic[T]): """Saves and loads arbitrary python objects.""" def __init__(self) -> None: - self._on_saved_callbacks: list[Callable[[str, T], None]] = [] self._on_deleted_callbacks: list[Callable[[str], None]] = [] @abstractmethod @@ -36,18 +35,10 @@ class ObjectSerializerBase(ABC, Generic[T]): """ pass - def on_saved(self, on_saved: Callable[[str, T], None]) -> None: - """Register a callback for when an object is saved""" - self._on_saved_callbacks.append(on_saved) - def on_deleted(self, on_deleted: Callable[[str], None]) -> None: """Register a callback for when an object is deleted""" self._on_deleted_callbacks.append(on_deleted) - def _on_saved(self, name: str, obj: T) -> None: - for callback in self._on_saved_callbacks: - callback(name, obj) - def _on_deleted(self, name: str) -> None: for callback in self._on_deleted_callbacks: callback(name) diff --git a/invokeai/app/services/object_serializer/object_serializer_forward_cache.py b/invokeai/app/services/object_serializer/object_serializer_forward_cache.py index 40e34e6540..2a4ecdd844 100644 --- a/invokeai/app/services/object_serializer/object_serializer_forward_cache.py +++ b/invokeai/app/services/object_serializer/object_serializer_forward_cache.py @@ -41,7 +41,6 @@ class ObjectSerializerForwardCache(ObjectSerializerBase[T]): def save(self, obj: T) -> str: name = self._underlying_storage.save(obj) self._set_cache(name, obj) - self._on_saved(name, obj) return name def delete(self, name: str) -> None: