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

@@ -110,11 +110,11 @@ class HFBandCondition:
"""Data class representing HF propagation conditions for certain bands and time of day."""
# Band name, e.g. "80m-40m", "20m-17m", "10m-6m"
band: str = None
band: str | None = None
# Time of day: "day" or "night"
time: str = None
time: str | None = None
# Propagation condition: "Good", "Fair", or "Poor"
condition: str = None
condition: str | None = None
@dataclass
@@ -122,66 +122,66 @@ class SolarConditions:
"""Data class representing current solar and propagation conditions."""
# Time the data was last updated at the source, UTC seconds since UNIX epoch
updated: float = None
updated: float | None = None
# Solar Flux Index (SFI)
sfi: int = None
sfi: int | None = None
# A-index (daily geomagnetic activity)
a_index: int = None
a_index: int | None = None
# K-index (3-hour geomagnetic activity)
k_index: int = None
k_index: int | None = None
# X-ray flux class, e.g. "B2.3", "C1.0"
xray: str = None
xray: str | None = None
# Proton flux
proton_flux: int = None
proton_flux: int | None = None
# Electron flux
electron_flux: int = None
electron_flux: int | None = None
# Aurora activity level
aurora: int = None
aurora: int | None = None
# Latitude in degrees of the aurora boundary
aurora_latitude: float = None
aurora_latitude: float | None = None
# Sunspot count
sunspots: int = None
sunspots: int | None = None
# Solar wind speed in km/s
solar_wind: float = None
solar_wind: float | None = None
# Interplanetary magnetic field strength in nT
magnetic_field: float = None
magnetic_field: float | None = None
# Geomagnetic field condition, e.g. "Quiet", "Unsettled", "Active", "Storm"
geomag_field: str = None
geomag_field: str | None = None
# Geomagnetic background noise level, e.g. "S0", "S1", "S2"
geomag_noise: str = None
geomag_noise: str | None = None
# HF band propagation conditions, keyed by "{band}-{time}" e.g. "80m-40m-day"
hf_conditions: dict = None
hf_conditions: dict | None = None
# VHF propagation conditions, keyed by condition name
vhf_conditions: dict = None
vhf_conditions: dict | None = None
# NOAA Kp index 3-day forecast, keyed by UNIX timestamp of the start of each 3-hour UTC period
k_index_forecast: dict = None
k_index_forecast: dict | None = None
# NOAA Solar Radiation Storm (S1 or greater) probability forecast, keyed by UNIX timestamp of start of day UTC
solar_storm_forecast: dict = None
solar_storm_forecast: dict | None = None
# NOAA Radio Blackout (R1-R2) probability forecast, keyed by UNIX timestamp of start of day UTC
blackout_forecast_r1r2: dict = None
blackout_forecast_r1r2: dict | None = None
# NOAA Radio Blackout (R3 or greater) probability forecast, keyed by UNIX timestamp of start of day UTC
blackout_forecast_r3_or_greater: dict = None
blackout_forecast_r3_or_greater: dict | None = None
# Ionosonde measurements, dict keyed by URSI code, values are dicts with keys: ursi, name, fof2, muf, luf,
# band_states. Populated by GIROIonosonde or KC2GProp providers.
ionosonde_data: dict = None
ionosonde_data: dict | None = None
# Derived values (populated by infer_descriptions())
# HF radio blackout risk description, derived from xray
xray_desc: str = None
xray_desc: str | None = None
# HF radio blackout scale number (R0-R5), derived from xray
radio_blackout_scale: int = None
radio_blackout_scale: int | None = None
# Solar radiation storm level description, derived from proton_flux
proton_flux_desc: str = None
proton_flux_desc: str | None = None
# Solar radiation storm scale number (S0-S5), derived from proton_flux
solar_storm_scale: int = None
solar_storm_scale: int | None = None
# Geomagnetic storm level description, derived from k_index
geomag_storm_desc: str = None
geomag_storm_desc: str | None = None
# Geomagnetic storm scale number (G0-G5), derived from k_index
geomag_storm_scale: int = None
geomag_storm_scale: int | None = None
# Overall HF band conditions summary, derived from sfi
band_conditions_desc: str = None
band_conditions_desc: str | None = None
# Electron flux description, derived from electron_flux
electron_flux_desc: str = None
electron_flux_desc: str | None = None
def infer_descriptions(self):
"""Populate derived text description fields from the current numeric/raw field values."""