From 43ef4bccdfeec60799839c04a770343157be548b Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 22 Aug 2020 14:31:00 +0200 Subject: [PATCH] LINT fixes --- platypush/backend/adafruit/io.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/platypush/backend/adafruit/io.py b/platypush/backend/adafruit/io.py index 0a791350f..fe24ff14d 100644 --- a/platypush/backend/adafruit/io.py +++ b/platypush/backend/adafruit/io.py @@ -42,6 +42,7 @@ class AdafruitIoBackend(Backend): if not plugin: raise RuntimeError('Adafruit IO plugin not configured') + # noinspection PyProtectedMember self._client = MQTTClient(plugin._username, plugin._key) self._client.on_connect = self.on_connect() self._client.on_disconnect = self.on_disconnect() @@ -52,18 +53,25 @@ class AdafruitIoBackend(Backend): for feed in self.feeds: client.subscribe(feed) self.bus.post(ConnectedEvent()) + return _handler def on_disconnect(self): def _handler(client): self.bus.post(DisconnectedEvent()) + return _handler - def on_message(self): + def on_message(self, msg): + # noinspection PyUnusedLocal def _handler(client, feed, data): - try: data = float(data) - except: pass + # noinspection PyBroadException + try: + data = float(data) + except: + pass self.bus.post(FeedUpdateEvent(feed=feed, data=data)) + return _handler def run(self): @@ -81,5 +89,4 @@ class AdafruitIoBackend(Backend): self.logger.exception(e) self._client = None - # vim:sw=4:ts=4:et: