mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-06-23 21:25:12 +00:00
Fix some IDE warnings, mostly around type safety on the Python side
This commit is contained in:
@@ -28,7 +28,8 @@ class GIROIonosonde(SolarConditionsProvider):
|
||||
self._thread = None
|
||||
self._stop_event = Event()
|
||||
|
||||
def _load_stations(self):
|
||||
@staticmethod
|
||||
def _load_stations():
|
||||
stations = []
|
||||
with open(STATIONS_INDEX, newline='') as f:
|
||||
for row in csv.reader(f):
|
||||
|
||||
@@ -32,6 +32,9 @@ class HamQSL(HTTPSolarConditionsProvider):
|
||||
# Some error checking functions in case the data is janky.
|
||||
|
||||
def text(tag, default=None):
|
||||
if sd is None:
|
||||
logging.warning("HamQSL solar conditions API returned unexpected XML structure")
|
||||
return default
|
||||
el = sd.find(tag)
|
||||
return el.text.strip() if el is not None and el.text else default
|
||||
|
||||
@@ -104,7 +107,7 @@ class HamQSL(HTTPSolarConditionsProvider):
|
||||
"geomag_noise": text("signalnoise"),
|
||||
"hf_conditions": hf_conditions,
|
||||
"vhf_conditions": {
|
||||
"vhf_aurora_northern_hemi": vhf_map.get(("vhf-aurora", "northern_hemi")).title().replace("Lat Aur", "Latitude"),
|
||||
"vhf_aurora_northern_hemi": (vhf_map.get(("vhf-aurora", "northern_hemi")) or "").title().replace("Lat Aur", "Latitude") or None,
|
||||
"es_2m_europe": vhf_map.get(("E-Skip", "europe")),
|
||||
"es_4m_europe": vhf_map.get(("E-Skip", "europe_4m")),
|
||||
"es_6m_europe": vhf_map.get(("E-Skip", "europe_6m")),
|
||||
|
||||
@@ -3,8 +3,8 @@ from core.constants import BANDS
|
||||
HF_BANDS = [b for b in BANDS if b.is_ham_hf]
|
||||
|
||||
|
||||
def _latest(d):
|
||||
return d[max(d.keys())] if d else None
|
||||
def _latest(d) -> float | None:
|
||||
return float(d[max(d.keys())]) if d else None
|
||||
|
||||
|
||||
def compute_band_states(fof2_dict, muf_dict, luf_dict):
|
||||
|
||||
@@ -10,6 +10,7 @@ class SolarConditionsProvider:
|
||||
def __init__(self, provider_config):
|
||||
"""Constructor"""
|
||||
|
||||
self._solar_conditions_cache = None
|
||||
self.name = provider_config["name"]
|
||||
self.enabled = provider_config["enabled"]
|
||||
self.last_update_time = datetime.min.replace(tzinfo=pytz.UTC)
|
||||
|
||||
Reference in New Issue
Block a user