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
+9 -7
View File
@@ -1,6 +1,8 @@
from __future__ import annotations
import logging
from datetime import datetime
from typing import ClassVar
from typing import Any, ClassVar
import requests
@@ -36,11 +38,11 @@ class Tiles(HTTPSpotProvider):
"Other",
]
def __init__(self, provider_config):
def __init__(self, provider_config: dict[str, Any]) -> None:
super().__init__("Tiles", provider_config, self.SPOTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_spots(self, http_response):
new_spots = []
def _http_response_to_spots(self, http_response: requests.Response) -> list[Spot]:
new_spots: list[Spot] = []
# Iterate through source data
for source_spot in http_response.json()["spots"]:
# Convert to our spot format
@@ -84,10 +86,10 @@ class Tiles(HTTPSpotProvider):
new_spots.append(spot)
return new_spots
def can_submit_spot(self, activity):
def can_submit_spot(self, activity: str) -> bool:
return activity == ActivityName.TILES
def submit_spot(self, spot, credentials):
def submit_spot(self, spot: Spot, credentials: dict[str, str]) -> None:
# Tiles on the air currently only supports *self* spots
if spot.dx_call == spot.de_call:
# Figure out a valid mode. Borrowed this from PoLo :)
@@ -127,7 +129,7 @@ class Tiles(HTTPSpotProvider):
# Utility function to keep the first decimal point in a given string but remove any others. Used to parse Tiles'
# strange frequency format where we can sometimes have e.g. "14.123.5".
def strip_extra_decimal_points(s):
def strip_extra_decimal_points(s: str) -> str:
parts = s.split(".", 1)
if len(parts) == 1:
return s