浏览代码

Make Label() object hashable

Since it got custom __eq__ function, __hash__ needs to be implemented
too. Otherwise it can't be used as a key in dict.
Marek Marczykowski-Górecki 3 年之前
父节点
当前提交
a078e1f617
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      qubesadmin/label.py

+ 3 - 0
qubesadmin/label.py

@@ -80,3 +80,6 @@ class Label(object):
         if isinstance(other, Label):
             return self.name == other.name
         return NotImplemented
+
+    def __hash__(self):
+        return hash(self.name)