Proper fix for variable arguments on process_data

This commit is contained in:
Fabio Manganiello 2022-02-17 12:43:56 +01:00
parent 1933ec709f
commit e3f67766a3
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
3 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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', {})

View File

@ -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()