summaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2015-02-19 17:55:08 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2015-02-23 15:47:10 -0800
commit71c1b8b38854087bad313fc945991874d9181d18 (patch)
tree8d8965c1414471fd066ffe1552bf94795c515a01 /registry
parent8279c52da3532b5f75428b84d6f605cd7a1addc8 (diff)
registry/gl.py: add hash methods for classes that need to be hashed
Adds __hash__ methods to a few classes. These aren't particularly unique, but they're good enough for our uses. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'registry')
-rw-r--r--registry/gl.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/registry/gl.py b/registry/gl.py
index 288a4fcb2..f85e393cf 100644
--- a/registry/gl.py
+++ b/registry/gl.py
@@ -633,6 +633,10 @@ class Requirement(object):
_log_debug('created {0}'.format(self))
+ def __hash__(self):
+ return hash('__Requirement_class_{}_{}_'.format(
+ self.provider, self.provided))
+
def __eq__(self, other):
if self.provider != other.provider:
return False
@@ -780,6 +784,9 @@ class Command(object):
'alias={self.alias!r}, '
'prototype={self.c_prototype!r})').format(self=self))
+ def __hash__(self):
+ return hash('__Command_class_{}_'.format(self.name))
+
def __eq__(self, other):
return self.name == other.name
@@ -860,6 +867,9 @@ class CommandAliasSet(ImmutableOrderedKeyedSet):
templ = '{self.__class__.__name__}({self.name!r})'
return templ.format(self=self)
+ def __hash__(self):
+ return hash(repr(self))
+
@property
def name(self):
return self.primary_command.name