mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
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:
@@ -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", "")
|
||||
|
||||
Reference in New Issue
Block a user