Turns out "if x in list" returns true if list[x] = None, so guard against that by checking list.get(x) instead

This commit is contained in:
Ian Renton
2026-09-18 21:33:26 +01:00
parent 4b51dd9ba5
commit f0df4f38ca
13 changed files with 32 additions and 32 deletions
+2 -2
View File
@@ -42,7 +42,7 @@ class UKPacketNet(HTTPSpotProvider):
)
comment = (
f"{comment} {listed_port['baud']!s} baud"
if "baud" in listed_port and listed_port["baud"] > 0
if listed_port.get("baud") and listed_port["baud"] > 0
else comment
)
@@ -50,7 +50,7 @@ class UKPacketNet(HTTPSpotProvider):
# very hacky but a lot of node comments contain their frequency as the first or second
# word of their comment, but not in the proper data structure field.
freq = (
listed_port["freq"] if "freq" in listed_port and listed_port["freq"] > 0 else None
listed_port["freq"] if listed_port.get("freq") and listed_port["freq"] > 0 else None
)
if not freq and comment:
possible_freq = comment.split(" ")[0].upper().replace("MHZ", "")