We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b56c345 commit a60b063Copy full SHA for a60b063
minfraud/models.py
@@ -2,6 +2,7 @@
2
3
from __future__ import annotations
4
5
+import json
6
from typing import TYPE_CHECKING
7
8
import geoip2.models
@@ -18,6 +19,10 @@ def __eq__(self, other: object) -> bool:
18
19
def __ne__(self, other: object) -> bool:
20
return not self.__eq__(other)
21
22
+ def __hash__(self) -> int:
23
+ # This is not particularly efficient, but I don't expect it to be used much.
24
+ return hash(json.dumps(self.to_dict(), sort_keys=True))
25
+
26
def to_dict(self) -> dict: # noqa: C901
27
"""Return a dict of the object suitable for serialization."""
28
result = {}
0 commit comments