ruff fixes

This commit is contained in:
Ian Renton
2026-09-18 18:38:35 +01:00
parent 40033d122e
commit 1a1743d11c
18 changed files with 34 additions and 21 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ class DXCluster(SpotProvider):
telnet_output = self._telnet.read_until("\n".encode("latin-1"))
match = self._spot_line_pattern.match(telnet_output.decode("latin-1"))
if match:
spot_time = datetime.strptime(match.group(5), "%H%MZ")
spot_time = datetime.strptime(match.group(5), "%H%MZ").replace(tzinfo=pytz.UTC)
spot_datetime = datetime.combine(
datetime.now(pytz.UTC).date(),
spot_time.time(),
+2 -1
View File
@@ -1,6 +1,7 @@
import logging
import re
from datetime import datetime
from typing import ClassVar
import pytz
import requests
@@ -20,7 +21,7 @@ class ParksNPeaks(HTTPSpotProvider):
POLL_INTERVAL_SEC = 120
SPOTS_URL = "https://www.parksnpeaks.org/api/ALL"
SUBMIT_URL = "https://www.parksnpeaks.org/api/SPOT/"
SUBMITTABLE_ACTIVITIES = [
SUBMITTABLE_ACTIVITIES: ClassVar[list[ActivityName]] = [
ActivityName.POTA,
ActivityName.SOTA,
ActivityName.WWFF,
+1 -1
View File
@@ -69,7 +69,7 @@ class RBN(SpotProvider):
telnet_output = self._telnet.read_until("\n".encode("latin-1"))
match = self._LINE_PATTERN.match(telnet_output.decode("latin-1"))
if match:
spot_time = datetime.strptime(match.group(5), "%H%MZ")
spot_time = datetime.strptime(match.group(5), "%H%MZ").replace(tzinfo=pytz.UTC)
spot_datetime = datetime.combine(
datetime.now(pytz.UTC).date(),
spot_time.time(),
+2 -1
View File
@@ -1,5 +1,6 @@
import logging
from datetime import datetime
from typing import ClassVar
import requests
from requests.exceptions import ConnectionError, ConnectTimeout, ReadTimeout
@@ -24,7 +25,7 @@ class SOTA(HTTPSpotProvider):
SPOTS_URL = "https://api-db2.sota.org.uk/api/spots/60/all/all"
SUBMIT_URL = "https://api-db2.sota.org.uk/api/spots"
VALID_MODES = ["AM", "CW", "Data", "DV", "FM", "SSB"]
VALID_MODES: ClassVar[list[str]] = ["AM", "CW", "Data", "DV", "FM", "SSB"]
def __init__(self, provider_config):
super().__init__("SOTA", provider_config, self.EPOCH_URL, self.POLL_INTERVAL_SEC)
+2 -1
View File
@@ -1,5 +1,6 @@
import logging
from datetime import datetime
from typing import ClassVar
import requests
@@ -18,7 +19,7 @@ class Tiles(HTTPSpotProvider):
POLL_INTERVAL_SEC = 120
SPOTS_URL = "https://icneuzxitdqtofutxbla.supabase.co/functions/v1/spots?active_hours=24"
SUBMIT_URL = "https://icneuzxitdqtofutxbla.supabase.co/functions/v1/self-spot"
VALID_MODES = [
VALID_MODES: ClassVar[list[str]] = [
"SSB",
"CW",
"FT8",
+1 -1
View File
@@ -81,7 +81,7 @@ class WebsocketSpotProvider(SpotProvider):
self._ws.close()
except Exception:
# No problem, we were getting rid of this object anyway.
pass
logger.debug(f"Exception while closing socket in {self.name}", exc_info=True)
self._ws = None
if not self._stop_event.is_set():
self._stop_event.wait(timeout=5) # Wait before trying to reconnect
+4 -2
View File
@@ -54,7 +54,7 @@ class WOTA(HTTPSpotProvider):
if len(ref_split) > 1:
ref_name = str(ref_split[1])
except Exception:
logger.warning(f"Could not parse WOTA spot title: {source_spot.title}")
logger.warning(f"Could not parse WOTA spot title: {source_spot.title}", exc_info=True)
# Pick apart the description
freq_hz = None
@@ -75,7 +75,9 @@ class WOTA(HTTPSpotProvider):
if len(desc_split) > 2:
spotter = desc_split[2].replace("Spotted by ", "").replace(".", "").upper().strip()
except Exception:
logger.warning(f"Could not parse WOTA spot description: {source_spot.description}")
logger.warning(
f"Could not parse WOTA spot description: {source_spot.description}", exc_info=True
)
time = datetime.strptime(source_spot.pub_date.content, self.RSS_DATE_TIME_FORMAT).astimezone(
pytz.UTC
-1
View File
@@ -17,7 +17,6 @@ class XOTA(WebsocketSpotProvider):
is why we also provide a sig_ref_prefix in our config. This is applied to the reference ID, so e.g. "T-01" at C3
might become "C3 T-01". This allows us to provide location lookups for TOTA at several conferences."""
LOCATION_DATA = {}
ACTIVITY = None
def __init__(self, provider_config):