Skip to content

Commit

Permalink
hashable object
Browse files Browse the repository at this point in the history
  • Loading branch information
simplymathematics committed Aug 13, 2024
1 parent 658e987 commit 40594bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deckard/base/utils/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
return int(my_hash(self), 16)

0 comments on commit 40594bb

Please sign in to comment.