Bulk convert comments above classes/functions/methods into proper docstrings

This commit is contained in:
Ian Renton
2026-02-27 14:21:35 +00:00
parent 068c732796
commit 6b18ec6f88
63 changed files with 540 additions and 349 deletions

View File

@@ -6,11 +6,12 @@ from time import sleep
import pytz
# Provides a timed cleanup of the spot list.
class CleanupTimer:
"""Provides a timed cleanup of the spot list."""
# Constructor
def __init__(self, spots, alerts, web_server, cleanup_interval):
"""Constructor"""
self.spots = spots
self.alerts = alerts
self.web_server = web_server
@@ -20,21 +21,24 @@ class CleanupTimer:
self.status = "Starting"
self._stop_event = Event()
# Start the cleanup timer
def start(self):
"""Start the cleanup timer"""
self._thread = Thread(target=self._run, daemon=True)
self._thread.start()
# Stop any threads and prepare for application shutdown
def stop(self):
"""Stop any threads and prepare for application shutdown"""
self._stop_event.set()
def _run(self):
while not self._stop_event.wait(timeout=self.cleanup_interval):
self._cleanup()
# Perform cleanup and reschedule next timer
def _cleanup(self):
"""Perform cleanup and reschedule next timer"""
try:
# Perform cleanup via letting the data expire
self.spots.expire()