quebs: make Label() and storage.Pool() objects hashable

This commit is contained in:
Marek Marczykowski-Górecki 2017-04-25 22:50:12 +02:00
parent 59426b2dbc
commit f324d30d4e
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 6 additions and 0 deletions

View File

@ -110,6 +110,9 @@ class Label(object):
return self.name == other.name return self.name == other.name
return NotImplemented return NotImplemented
def __hash__(self):
return hash(self.name)
@builtins.property @builtins.property
def icon_path(self): def icon_path(self):
'''Icon path '''Icon path

View File

@ -519,6 +519,9 @@ class Pool(object):
def __str__(self): def __str__(self):
return self.name return self.name
def __hash__(self):
return hash(self.name)
def __xml__(self): def __xml__(self):
config = _sanitize_config(self.config) config = _sanitize_config(self.config)
return lxml.etree.Element('pool', **config) return lxml.etree.Element('pool', **config)