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 -4
View File
@@ -1,11 +1,15 @@
from __future__ import annotations
import gzip
import logging
from typing import Any
from pyhamtools import Callinfo, LookupLib
from core.data_store import DATA_STORE
from core.utils import get_callsign_object_from_pyhamtools_callinfo
from data.callsign import Callsign
from data.lookup_credentials import LookupCredentials
from providers.callsigndata.file_download_callsign_data_provider import (
FileDownloadCallsignDataProvider,
)
@@ -20,9 +24,9 @@ class ClublogXML(FileDownloadCallsignDataProvider):
DATA_URL = "https://cdn.clublog.org/cty.php"
CACHE_PATH_ZIPPED = "cache/cty.xml.gz"
CACHE_PATH_UNZIPPED = "cache/cty.xml"
_callinfo = None
_callinfo: Callinfo | None = None
def __init__(self, provider_config):
def __init__(self, provider_config: dict[str, Any]) -> None:
# API key required for this provider
self._api_key = provider_config.get("api_key", "")
if self._api_key == "":
@@ -40,7 +44,7 @@ class ClublogXML(FileDownloadCallsignDataProvider):
DATA_STORE.callsign_data_clublogxml,
)
def _handle_file(self, path):
def _handle_file(self, path: str) -> bool:
try:
# The download from Clublog is gzipped so we need to uncompress that and re-save as a separate file that
# the LookupLib can actually use.
@@ -60,7 +64,7 @@ class ClublogXML(FileDownloadCallsignDataProvider):
logger.exception("Exception when loading Clublog XML.")
return False
def _perform_new_lookup(self, callsign, lookup_credentials):
def _perform_new_lookup(self, callsign: str, lookup_credentials: LookupCredentials | None) -> Callsign | None:
callsign_data = Callsign(call=callsign)
try: