Commit 7ed9b4aa by Calen Pennington

Add hashing and equality methods to Location

parent 736148f2
......@@ -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):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment