mirror of https://github.com/scrapy/scrapy.git
add __hash__ method to Link object to be compatible with the __eq__ method
This commit is contained in:
parent
32adbea545
commit
c5351d2f48
|
|
@ -18,6 +18,9 @@ class Link(object):
|
|||
|
||||
def __eq__(self, other):
|
||||
return self.url == other.url and self.text == other.text
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.url) ^ hash(self.text)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Link url=%r text=%r >' % (self.url, self.text)
|
||||
|
|
|
|||
Loading…
Reference in New Issue