Explorar o código

qubes: add property ordering

Marek Marczykowski-Górecki %!s(int64=7) %!d(string=hai) anos
pai
achega
d68499f17f
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      qubes/__init__.py

+ 5 - 0
qubes/__init__.py

@@ -299,6 +299,11 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
     def __hash__(self):
         return hash(self.__name__)
 
+    def __lt__(self, other):
+        if isinstance(other, property):
+            return self.__name__ < other.__name__
+        else:
+            return self < other
 
     def __eq__(self, other):
         return isinstance(other, property) and self.__name__ == other.__name__