Skip to content

Commit 7668358

Browse files
committed
Add __hash__ method for models
1 parent d5ed14e commit 7668358

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

geoip2/_internal.py

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

15+
def __hash__(self) -> int:
16+
return hash(self.to_dict())
17+
1518
def to_dict(self) -> dict: # noqa: C901, PLR0912
1619
"""Return a dict of the object suitable for serialization."""
1720
result = {}

0 commit comments

Comments
 (0)