mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
tidy(nodes): remove object serializer on_saved
It's unused.
This commit is contained in:
parent
9f382419dc
commit
507aeac8a5
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user