switch condition sequencing to get better error messages

This commit is contained in:
Jakob Ketterl 2021-04-27 01:15:56 +02:00
parent d97d66c787
commit e408c66702
1 changed files with 3 additions and 3 deletions

View File

@ -27,9 +27,9 @@ class MappedSdrSources(PropertyDelegator):
self._addSource(key, value)
def handleDeviceUpdate(self, key, value, *args):
if self.isDeviceValid(value) and key not in self:
if key not in self and self.isDeviceValid(value):
self[key] = self.buildNewSource(key, value)
elif not self.isDeviceValid(value) and key in self:
elif key in self and not self.isDeviceValid(value):
del self[key]
def _addSource(self, key, value):
@ -41,7 +41,7 @@ class MappedSdrSources(PropertyDelegator):
]
def isDeviceValid(self, device):
return self._hasProfiles(device) and self._sdrTypeAvailable(device)
return self._sdrTypeAvailable(device) and self._hasProfiles(device)
def _hasProfiles(self, device):
return "profiles" in device and device["profiles"] and len(device["profiles"]) > 0