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
+8 -6
View File
@@ -1,3 +1,5 @@
from __future__ import annotations
import logging
import os
from datetime import datetime
@@ -21,11 +23,11 @@ logger = logging.getLogger(__name__)
class StatusReporter:
"""Provides a timed update of the application's status data."""
def __init__(self, run_interval):
def __init__(self, run_interval: float) -> None:
"""Constructor"""
self._run_interval = run_interval
self._thread = None
self._thread: Thread | None = None
self._stop_event = Event()
self._startup_time = datetime.now(pytz.UTC)
@@ -33,13 +35,13 @@ class StatusReporter:
DATA_STORE.status.get()["server_owner_callsign"] = SERVER_OWNER_CALLSIGN
DATA_STORE.status.store()
def start(self):
def start(self) -> None:
"""Start the reporter thread"""
self._thread = Thread(target=self._run, name="StatusReporter", daemon=True)
self._thread.start()
def stop(self):
def stop(self) -> None:
"""Stop any threads and prepare for application shutdown"""
self._stop_event.set()
@@ -48,7 +50,7 @@ class StatusReporter:
if self._thread.is_alive():
logger.warning("Status reporter worker thread did not exit on time and will be killed.")
def _run(self):
def _run(self) -> None:
"""Thread entry point: report immediately on startup, then on each interval until stopped"""
while True:
@@ -56,7 +58,7 @@ class StatusReporter:
if self._stop_event.wait(timeout=self._run_interval):
break
def _report(self):
def _report(self) -> None:
"""Write status information"""
DATA_STORE.status.get()["uptime"] = (datetime.now(pytz.UTC) - self._startup_time).total_seconds()