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 d5ed14e commit 34e607cCopy full SHA for 34e607c
geoip2/_internal.py
@@ -1,5 +1,6 @@
1
"""Internal utilities."""
2
3
+import json
4
from abc import ABCMeta
5
6
@@ -12,6 +13,10 @@ def __eq__(self, other: object) -> bool:
12
13
def __ne__(self, other: object) -> bool:
14
return not self.__eq__(other)
15
16
+ def __hash__(self) -> int:
17
+ # This is not particularly efficient, but I don't expect it to be used much.
18
+ return hash(json.dumps(self.to_dict(), sort_keys=True))
19
+
20
def to_dict(self) -> dict: # noqa: C901, PLR0912
21
"""Return a dict of the object suitable for serialization."""
22
result = {}
0 commit comments