v1.22
Changes
- Support for hooks declared in superclasses
class Counter:
deserialize = 0
serialize = 0
@classmethod
def __pre_deserialize__(cls, d):
Counter.deserialize += 1
return d
def __pre_serialize__(self):
Counter.serialize += 1
return self
@dataclass
class Derived(Counter, DataClassDictMixin):
a: int
obj = Derived.from_dict({"a": 1})
obj.to_dict()
print(Counter.deserialize) # 1
print(Counter.serialize) # 1