Added TOC to readme and more LGTM fixes

This commit is contained in:
Fabio Manganiello 2022-02-09 21:06:49 +01:00
parent 29a7eff15a
commit 94bb3e0541
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
4 changed files with 8 additions and 4 deletions

View file

@ -10,6 +10,8 @@ Platypush
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/BlackLight/platypush.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/BlackLight/platypush/context:python)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/BlackLight/platypush.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/BlackLight/platypush/context:javascript)
[[__TOC__]]
- Recommended read: [**Getting started with Platypush**](https://blog.platypush.tech/article/Ultimate-self-hosted-automation-with-Platypush).
- The [blog](https://blog.platypush.tech) is in general a good place to get more insights on what you can build with it and inspiration about possible usages.

View file

@ -84,7 +84,9 @@ class BluetoothScannerBackend(SensorBackend):
with self._bt_lock:
return super().get_measurement()
def process_data(self, data: Dict[str, dict], new_data: Dict[str, dict]):
def process_data( # lgtm [py/inheritance/signature-mismatch]
self, *, data: Dict[str, dict], new_data: Dict[str, dict]
):
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], *args, **kwargs):
def process_data(self, *, data: Dict[str, dict], **kwargs):
instances = data['instances']
old_instances = (self.data or {}).get('instances', {})

View file

@ -539,8 +539,8 @@ class CameraPlugin(Plugin, ABC):
def _prepare_server_socket(camera: Camera) -> socket.socket:
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind((
camera.info.bind_address or '0.0.0.0', # lgtm [py/bind-socket-all-network-interfaces]
server_socket.bind(( # lgtm [py/bind-socket-all-network-interfaces]
camera.info.bind_address or '0.0.0.0',
camera.info.listen_port
))
server_socket.listen(1)