Skip to content

Commit 8c56b19

Browse files
committed
Implement __hash__ in models
Ruff wants this whenever __eq__ is implemented.
1 parent b56c345 commit 8c56b19

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

minfraud/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ def __eq__(self, other: object) -> bool:
1818
def __ne__(self, other: object) -> bool:
1919
return not self.__eq__(other)
2020

21+
def __hash__(self) -> int:
22+
return hash(self.to_dict())
23+
2124
def to_dict(self) -> dict: # noqa: C901
2225
"""Return a dict of the object suitable for serialization."""
2326
result = {}

0 commit comments

Comments
 (0)