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 untrusted user: 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() return super().get_measurement()
def process_data( # lgtm [py/inheritance/signature-mismatch] 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(): for addr, dev in data.items():
self._add_last_seen_device(dev) self._add_last_seen_device(dev)

View file

@ -25,7 +25,7 @@ class LinodeBackend(SensorBackend):
super().__init__(plugin='linode', poll_seconds=poll_seconds, **kwargs) super().__init__(plugin='linode', poll_seconds=poll_seconds, **kwargs)
self.instances = set(instances or []) 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'] instances = data['instances']
old_instances = (self.data or {}).get('instances', {}) old_instances = (self.data or {}).get('instances', {})

View file

@ -174,9 +174,9 @@ class SensorBackend(Backend):
if plugin and hasattr(plugin, 'close'): if plugin and hasattr(plugin, 'close'):
plugin.close() plugin.close()
def process_data(self, new_data, *_, **__): def process_data(self, data, new_data=None, **__):
if new_data is not None and new_data not in ({}, []): if data is not None and data not in ({}, []):
self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__)) self.bus.post(SensorDataChangeEvent(data=data, source=self.plugin or self.__class__.__name__))
def run(self): def run(self):
super().run() super().run()