feat: eq and hash for location

main
Khiem Ton 2 years ago
parent e0a520c8ea
commit 7c66e40b79
Signed by: th4tkh13m
GPG Key ID: 4D9CF147DCADD05D

@ -98,4 +98,13 @@ class Location(TypeDecorator):
def __repr__(self):
return str(self.latitude) + "," + str(self.longitude)
def __eq__(self, other):
if isinstance(other, Location):
return (self.latitude == other.latitude and
self.longitude == other.longitude)
return False
def __hash__(self):
return hash((self.latitude, self.longitude))
Loading…
Cancel
Save