From 37b9b2eefa44f7b0e89c93e5da3d43fc45c43a56 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 17 Jul 2019 10:03:57 +1000 Subject: [PATCH] base: simplify check for in register mode With a "or []" we can force this to be at least a 0-length list, obsoleting the None check. --- tuhi/base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tuhi/base.py b/tuhi/base.py index b0934d2..ba21654 100644 --- a/tuhi/base.py +++ b/tuhi/base.py @@ -336,8 +336,7 @@ class Tuhi(GObject.Object): # When the device is in register mode (blue light blinking), the # manufacturer is merely 4 bytes. This will reset to 7 bytes even # when the device simply times out and does not register fully. - manufacturer_data = bluez_device.manufacturer_data - return manufacturer_data is not None and len(manufacturer_data) == 4 + return len(bluez_device.manufacturer_data or []) == 4 def _on_bluez_discovery_started(self, manager): # Something else may turn discovery mode on, we don't care about