Split out event type SIGs, and do other enum conversions. Closes #138

This commit is contained in:
Ian Renton
2026-09-02 09:38:05 +01:00
parent 606cf1be68
commit 9d117a6069
54 changed files with 363 additions and 155 deletions
+11 -11
View File
@@ -11,8 +11,8 @@ from pyhamtools.locator import latlong_to_locator, locator_to_latlong
from core.call_lookup_helper import get_call_info
from core.config import MAX_SPOT_AGE
from core.constants import MODE_ALIASES, PROPAGATION_MODES, SIGS
from core.enums import Continent, LocationSourceForSpot, ModeSource, ModeType
from core.constants import PROPAGATION_MODES, SIGS
from core.enums import Continent, LocationSourceForSpot, Mode, ModeSource, ModeType
from core.geo_utils import lat_lon_to_cq_zone, lat_lon_to_itu_zone
from core.sig_lookup_helper import populate_missing_sig_ref_info
from core.sig_utils import (
@@ -103,7 +103,7 @@ class Spot:
# General QSO info
# Reported mode, such as SSB, PHONE, CW, FT8...
mode: str | None = None
mode: Mode = Mode.UNKNOWN
# Inferred mode "family".
mode_type: ModeType = ModeType.UNKNOWN
# Source of the mode information.
@@ -239,21 +239,21 @@ class Spot:
self.band = band.name
# Mode from comments or bandplan
if self.mode:
if not self.mode:
self.mode = Mode.UNKNOWN
if self.mode != Mode.UNKNOWN:
self.mode_source = ModeSource.SPOT
if self.comment and not self.mode:
if self.comment and self.mode == Mode.UNKNOWN:
self.mode = infer_mode_from_comment(self.comment)
self.mode_source = ModeSource.COMMENT
if self.freq and not self.mode:
if self.freq and self.mode == Mode.UNKNOWN:
self.mode = infer_mode_from_frequency(self.freq)
self.mode_source = ModeSource.BANDPLAN
# Normalise mode if necessary.
if self.mode in MODE_ALIASES:
self.mode = MODE_ALIASES[self.mode]
# Mode type from mode
if self.mode and not self.mode_type:
if not self.mode_type:
self.mode_type = ModeType.UNKNOWN
if self.mode != Mode.UNKNOWN and self.mode_type == ModeType.UNKNOWN:
self.mode_type = infer_mode_type_from_mode(self.mode)
# If we have a latitude or grid at this point, it can only have been provided by the spot itself