Fix some IDE warnings, mostly around type safety on the Python side

This commit is contained in:
Ian Renton
2026-06-19 21:33:46 +01:00
parent 05ac652cee
commit edb2641f76
42 changed files with 319 additions and 187 deletions

View File

@@ -1,7 +1,9 @@
from datetime import datetime
from typing import cast
import pytz
from rss_parser import Parser as RSSParser
from rss_parser.models.rss import RSS
from alertproviders.http_alert_provider import HTTPAlertProvider
from data.alert import Alert
@@ -20,7 +22,7 @@ class WOTA(HTTPAlertProvider):
def _http_response_to_alerts(self, http_response):
new_alerts = []
rss = RSSParser.parse(http_response.content.decode())
rss = cast(RSS, RSSParser.parse(http_response.content.decode()))
# Iterate through source data
for source_alert in rss.channel.items:
@@ -35,9 +37,9 @@ class WOTA(HTTPAlertProvider):
ref_name = None
if len(title_split) > 1:
ref_split = title_split[1].split(" - ")
ref = ref_split[0]
ref = str(ref_split[0])
if len(ref_split) > 1:
ref_name = ref_split[1]
ref_name = str(ref_split[1])
# Pick apart the description
desc_split = source_alert.description.split(". ")