From 40594bb5734df10037d3b5d522c3073d9afbadbc Mon Sep 17 00:00:00 2001 From: Charlie Meyers Date: Tue, 13 Aug 2024 18:17:58 +0000 Subject: [PATCH] hashable object --- deckard/base/utils/hashing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deckard/base/utils/hashing.py b/deckard/base/utils/hashing.py index f6fe067b..a8e7b1b2 100644 --- a/deckard/base/utils/hashing.py +++ b/deckard/base/utils/hashing.py @@ -72,7 +72,8 @@ def to_dict(obj: Union[dict, OrderedDict, NamedTuple]) -> dict: def my_hash(obj: Union[dict, OrderedDict, NamedTuple]) -> str: return md5(str(to_dict(obj)).encode("utf-8")).hexdigest() + @dataclass class Hashable: def __hash__(self): - return int(my_hash(self), 16) \ No newline at end of file + return int(my_hash(self), 16)