Explorar o código

Added better __eq__ method to Label class

Labels with the same name should not be distinguishable.

fixes QubesOS/qubes-issues#5944
Marta Marczykowska-Górecka %!s(int64=3) %!d(string=hai) anos
pai
achega
1a4cdba7f7
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      qubesadmin/label.py

+ 5 - 0
qubesadmin/label.py

@@ -75,3 +75,8 @@ class Label(object):
 
     def __str__(self):
         return self._name
+
+    def __eq__(self, other):
+        if isinstance(other, Label):
+            return self.name == other.name
+        return NotImplemented