Autogenerated type safety parameterisation of all methods

This commit is contained in:
Ian Renton
2026-09-20 20:02:19 +01:00
parent 6037e742cc
commit 324dd1414b
132 changed files with 1228 additions and 706 deletions
+11 -8
View File
@@ -1,6 +1,9 @@
from __future__ import annotations
import logging
from datetime import datetime
from threading import Event, Thread
from typing import Any
import aprslib
import pytz
@@ -15,17 +18,17 @@ logger = logging.getLogger(__name__)
class APRSIS(SpotProvider):
"""Spot provider for the APRS-IS."""
def __init__(self, provider_config):
def __init__(self, provider_config: dict[str, Any]) -> None:
super().__init__("APRS-IS", provider_config)
self._thread = None
self._aprsis = None
self._stop_event = Event()
self._thread: Thread | None = None
self._aprsis: aprslib.IS | None = None
self._stop_event: Event = Event()
def start(self):
def start(self) -> None:
self._thread = Thread(target=self._run, name="APRSISSpotProvider", daemon=True)
self._thread.start()
def _run(self):
def _run(self) -> None:
while not self._stop_event.is_set():
try:
self._aprsis = aprslib.IS(SERVER_OWNER_CALLSIGN)
@@ -43,7 +46,7 @@ class APRSIS(SpotProvider):
if not self._stop_event.is_set():
self._stop_event.wait(timeout=5)
def stop(self):
def stop(self) -> None:
self.status = "Shutting down"
self._stop_event.set()
if self._aprsis:
@@ -53,7 +56,7 @@ class APRSIS(SpotProvider):
if self._thread.is_alive():
logger.warning("APRS-IS worker thread did not exit on time and will be killed.")
def _handle(self, data):
def _handle(self, data: dict[str, Any]) -> None:
try:
# Split SSID in "from" call and store separately
from_parts = str(data["from"]).split("-")