Skip to content

Commit

Permalink
Make Label() object hashable
Browse files Browse the repository at this point in the history
Since it got custom __eq__ function, __hash__ needs to be implemented
too. Otherwise it can't be used as a key in dict.
  • Loading branch information
marmarek committed Jul 29, 2020
1 parent 60d28dc commit a078e1f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qubesadmin/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ def __eq__(self, other):
if isinstance(other, Label):
return self.name == other.name
return NotImplemented

def __hash__(self):
return hash(self.name)

0 comments on commit a078e1f

Please sign in to comment.