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 -5
View File
@@ -1,5 +1,8 @@
from __future__ import annotations
import json
from datetime import datetime
from typing import Any
from core.enums import ActivityName, ActivityRefType, Mode
from data.activity_ref import ActivityRef
@@ -12,14 +15,14 @@ class WWBOTA(SSESpotProvider):
SPOTS_URL = "https://api.wwbota.net/spots/"
def __init__(self, provider_config):
def __init__(self, provider_config: dict[str, Any]) -> None:
super().__init__("WWBOTA", provider_config, self.SPOTS_URL)
def _sse_message_to_spot(self, message_data):
def _sse_message_to_spot(self, message_data: str) -> Spot | None:
source_spot = json.loads(message_data)
# Convert to our spot format. First we unpack references, because WWBOTA spots can have more than one for
# n-fer activations.
refs = []
refs: list[ActivityRef] = []
for ref in source_spot["references"]:
activity_ref = ActivityRef(
id=ref["reference"],
@@ -52,9 +55,9 @@ class WWBOTA(SSESpotProvider):
# WWBOTA does support a special "Test" spot type, we need to avoid adding that.
return spot if source_spot["type"] != "Test" else None
def can_submit_spot(self, activity):
def can_submit_spot(self, activity: str) -> bool:
return activity == ActivityName.WWBOTA
def submit_spot(self, spot, credentials):
def submit_spot(self, spot: Spot, credentials: dict[str, str]) -> None:
# TODO: Implement. WWBOTA API docs cover this: https://api.wwbota.org/#tag/Spots/operation/create_spot_spots__post
raise NotImplementedError("WWBOTA upstream spot submission is not yet implemented")