Country and Venue now hashable, for #82
This commit is contained in:
parent
d0c80c8b4e
commit
9d5d56ceaf
2 changed files with 36 additions and 2 deletions
|
@ -1011,8 +1011,11 @@ class _BaseObject(object):
|
|||
return {}
|
||||
|
||||
def __hash__(self):
|
||||
# Convert any ints (or whatever) into strings
|
||||
values = map(str, self._get_params().values())
|
||||
|
||||
return hash(self.network) + \
|
||||
hash(str(type(self)) + "".join(list(self._get_params().keys()) + list(self._get_params().values())).lower())
|
||||
hash(str(type(self)) + "".join(list(self._get_params().keys()) + list(values)).lower())
|
||||
|
||||
class _Taggable(object):
|
||||
"""Common functions for classes with tags."""
|
||||
|
@ -1885,6 +1888,8 @@ class Country(_BaseObject):
|
|||
|
||||
name = None
|
||||
|
||||
__hash__ = _BaseObject.__hash__
|
||||
|
||||
def __init__(self, name, network):
|
||||
_BaseObject.__init__(self, network)
|
||||
|
||||
|
@ -3577,6 +3582,8 @@ class Venue(_BaseObject):
|
|||
location = None
|
||||
url = None
|
||||
|
||||
__hash__ = _BaseObject.__hash__
|
||||
|
||||
def __init__(self, id, network, venue_element=None):
|
||||
_BaseObject.__init__(self, network)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue