From e3f67766a3494a57c784957ecf945d0a6942db2a Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 17 Feb 2022 12:43:56 +0100 Subject: [PATCH] Proper fix for variable arguments on process_data --- platypush/backend/bluetooth/scanner/__init__.py | 2 +- platypush/backend/linode/__init__.py | 2 +- platypush/backend/sensor/__init__.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platypush/backend/bluetooth/scanner/__init__.py b/platypush/backend/bluetooth/scanner/__init__.py index e144e7f440..a0f220ee72 100644 --- a/platypush/backend/bluetooth/scanner/__init__.py +++ b/platypush/backend/bluetooth/scanner/__init__.py @@ -85,7 +85,7 @@ class BluetoothScannerBackend(SensorBackend): return super().get_measurement() def process_data( # lgtm [py/inheritance/signature-mismatch] - self, *, data: Dict[str, dict], new_data: Dict[str, dict] + self, data: Dict[str, dict], new_data: Optional[Dict[str, dict]] = None, **_ ): for addr, dev in data.items(): self._add_last_seen_device(dev) diff --git a/platypush/backend/linode/__init__.py b/platypush/backend/linode/__init__.py index 5b1f673a09..756eb2757d 100644 --- a/platypush/backend/linode/__init__.py +++ b/platypush/backend/linode/__init__.py @@ -25,7 +25,7 @@ class LinodeBackend(SensorBackend): super().__init__(plugin='linode', poll_seconds=poll_seconds, **kwargs) self.instances = set(instances or []) - def process_data(self, *, data: Dict[str, dict], **kwargs): + def process_data(self, data: Dict[str, dict], new_data: Optional[Dict[str, dict]] = None, **kwargs): instances = data['instances'] old_instances = (self.data or {}).get('instances', {}) diff --git a/platypush/backend/sensor/__init__.py b/platypush/backend/sensor/__init__.py index 556a5cf957..a0c0cd4cf4 100644 --- a/platypush/backend/sensor/__init__.py +++ b/platypush/backend/sensor/__init__.py @@ -174,9 +174,9 @@ class SensorBackend(Backend): if plugin and hasattr(plugin, 'close'): plugin.close() - def process_data(self, new_data, *_, **__): - if new_data is not None and new_data not in ({}, []): - self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__)) + def process_data(self, data, new_data=None, **__): + if data is not None and data not in ({}, []): + self.bus.post(SensorDataChangeEvent(data=data, source=self.plugin or self.__class__.__name__)) def run(self): super().run()