qubes: unify property ordering
We already have property ordering defined in property_list(), lets move it to proper place: property.__lt__.
This commit is contained in:
parent
9ace4e66f1
commit
5e43d26abd
@ -301,9 +301,9 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
|
|||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
if isinstance(other, property):
|
if isinstance(other, property):
|
||||||
return self.__name__ < other.__name__
|
return (self.load_stage, self.order, self.__name__) <\
|
||||||
else:
|
(other.load_stage, other.order, other.__name__)
|
||||||
return self < other
|
return NotImplemented
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return isinstance(other, property) and self.__name__ == other.__name__
|
return isinstance(other, property) and self.__name__ == other.__name__
|
||||||
@ -470,9 +470,7 @@ class PropertyHolder(qubes.events.Emitter):
|
|||||||
if load_stage is not None:
|
if load_stage is not None:
|
||||||
props = set(prop for prop in props
|
props = set(prop for prop in props
|
||||||
if prop.load_stage == load_stage)
|
if prop.load_stage == load_stage)
|
||||||
return sorted(props,
|
return sorted(props)
|
||||||
key=lambda prop: (prop.load_stage, prop.order, prop.__name__))
|
|
||||||
|
|
||||||
|
|
||||||
def _property_init(self, prop, value):
|
def _property_init(self, prop, value):
|
||||||
'''Initialise property to a given value, without side effects.
|
'''Initialise property to a given value, without side effects.
|
||||||
|
Loading…
Reference in New Issue
Block a user