py3: allow SearchResult instances to be hashed

This commit is contained in:
Eli Schwartz 2019-04-18 02:45:43 -04:00
parent 85378356db
commit 52f915d707
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -33,6 +33,9 @@ class SearchResult(object):
def __eq__(self, other): def __eq__(self, other):
return self.title == other.title and self.author == other.author and self.store_name == other.store_name and self.formats == other.formats return self.title == other.title and self.author == other.author and self.store_name == other.store_name and self.formats == other.formats
def __hash__(self):
return id(self)
def __str__(self): def __str__(self):
items = [] items = []
for x in 'store_name title author price formats detail_item cover_url'.split(): for x in 'store_name title author price formats detail_item cover_url'.split():