Add hashing and equality methods to Location
This commit is contained in:
@@ -101,9 +101,6 @@ class Location(object):
|
||||
if val is not None and INVALID_CHARS.search(val) is not None:
|
||||
raise InvalidLocationError(location)
|
||||
|
||||
def __str__(self):
|
||||
return self.url()
|
||||
|
||||
def url(self):
|
||||
"""
|
||||
Return a string containing the URL for this location
|
||||
@@ -136,6 +133,19 @@ class Location(object):
|
||||
'name': self.name,
|
||||
'revision': self.revision}
|
||||
|
||||
def __str__(self):
|
||||
return self.url()
|
||||
|
||||
def __repr__(self):
|
||||
return 'Location(%r)' % str(self)
|
||||
|
||||
def __hash__(self):
|
||||
return self.url()
|
||||
|
||||
def __eq__(self, other):
|
||||
return (isinstance(other, Location) and
|
||||
str(self) == str(other))
|
||||
|
||||
|
||||
class ModuleStore(object):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user