mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Support RSGB contests
This commit is contained in:
+6
-6
@@ -20,11 +20,11 @@ def safe_json_dumps(obj):
|
||||
return simplejson.dumps(obj, ensure_ascii=False, ignore_nan=True, default=lambda o: o.__dict__)
|
||||
|
||||
|
||||
def infer_mode_from_comment(comment: str) -> Mode:
|
||||
def infer_mode_from_comment(comment: str) -> Mode | None:
|
||||
"""Infer a mode from the comment"""
|
||||
|
||||
if not comment:
|
||||
return Mode.UNKNOWN
|
||||
return None
|
||||
|
||||
for mode in Mode:
|
||||
if re.search(r"(^|\W)" + mode + r"($|\W)", comment, re.IGNORECASE):
|
||||
@@ -33,14 +33,14 @@ def infer_mode_from_comment(comment: str) -> Mode:
|
||||
if re.search(r"(^|\W)" + alias + r"($|\W)", comment, re.IGNORECASE):
|
||||
return Mode(MODE_ALIASES[alias])
|
||||
|
||||
return Mode.UNKNOWN
|
||||
return None
|
||||
|
||||
|
||||
def infer_mode_type_from_mode(mode: str) -> ModeType:
|
||||
def infer_mode_type_from_mode(mode: str) -> ModeType | None:
|
||||
"""Infer a "mode family" from a mode ."""
|
||||
|
||||
if not mode:
|
||||
return ModeType.UNKNOWN
|
||||
return None
|
||||
|
||||
if mode in MODE_ALIASES:
|
||||
mode = MODE_ALIASES[mode]
|
||||
@@ -56,7 +56,7 @@ def infer_mode_type_from_mode(mode: str) -> ModeType:
|
||||
except ValueError:
|
||||
if mode.upper() != "OTHER" and mode != "?":
|
||||
logger.warning(f"Found an unrecognised mode: {mode}. Developer should categorise this.")
|
||||
return ModeType.UNKNOWN
|
||||
return None
|
||||
|
||||
|
||||
def infer_band_from_freq(freq):
|
||||
|
||||
Reference in New Issue
Block a user