devices : make DeviceInfo sortable

This commit is contained in:
Marek Marczykowski-Górecki 2017-05-30 21:33:24 +02:00
parent b08574acf3
commit 257c8c0821
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -359,6 +359,12 @@ class DeviceInfo(object):
self.ident == other.ident
)
def __lt__(self, other):
if isinstance(other, DeviceInfo):
return (self.backend_domain, self.ident) < \
(other.backend_domain, other.ident)
return NotImplemented
def __str__(self):
return '{!s}:{!s}'.format(self.backend_domain, self.ident)