mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
Implemented "is_dirty" for Autoserializables, to avoid publication and
This commit is contained in:
parent
d974d5904c
commit
72407449be
@ -177,10 +177,6 @@ class _ObservableDict(dict[T, V]):
|
||||
self._owner._dirty = True
|
||||
return super().popitem()
|
||||
|
||||
def setdefault(self, key: T, default: V, /) -> V:
|
||||
self._owner._dirty = True
|
||||
return super().setdefault(key, default)
|
||||
|
||||
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
|
||||
self._owner._dirty = True
|
||||
super().update(*args, **kwargs)
|
||||
@ -747,6 +743,9 @@ class AutoSerializable(Serializable, metaclass=_FieldNameSetter):
|
||||
def as_dict(self) -> dict[str, typing.Any]:
|
||||
return {k: v.__get__(self) for k, v in self._autoserializable_fields()}
|
||||
|
||||
def is_dirty(self) -> bool:
|
||||
return self._dirty or super().is_dirty()
|
||||
|
||||
def __eq__(self, other: typing.Any) -> bool:
|
||||
"""
|
||||
Basic equality check, checks if all _SerializableFields are equal
|
||||
|
Loading…
Reference in New Issue
Block a user