More ruff linter fixes

This commit is contained in:
Ian Renton
2026-08-15 08:43:19 +01:00
parent dd89ff4af7
commit a6e54f524d
43 changed files with 99 additions and 153 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ class UKPacketNet(HTTPSpotProvider):
new_spots = []
# Iterate through source data
nodes = http_response.json()["nodes"]
for callsign, node in nodes.items():
for node in nodes.values():
# The node corresponse to the spotter here. It has an "mheard" section which indicates which nodes it has
# recently heard, which will be our "DX". But "mheard" stations are not necessarily over RF, they could be
# via the internet, so we also need to look up the "port" on which the station was heard, and check that it
@@ -34,7 +34,7 @@ class UKPacketNet(HTTPSpotProvider):
# This is another packet station heard over RF, so we are good to create a Spot object.
# First build a "full" comment combining some of the extra info
comment = listed_port["comment"] if "comment" in listed_port else ""
comment = listed_port.get("comment", "")
comment = f"{comment} {listed_port['mode']}" if "mode" in listed_port else comment
comment = (
f"{comment} {listed_port['modulation']}" if "modulation" in listed_port else comment
@@ -82,7 +82,7 @@ class UKPacketNet(HTTPSpotProvider):
time=datetime.strptime(heard["lastHeard"], "%Y-%m-%d %H:%M:%S")
.replace(tzinfo=pytz.UTC)
.timestamp(),
de_grid=node["location"]["locator"] if "locator" in node["location"] else None,
de_grid=node["location"].get("locator", None),
de_latitude=node["location"]["coords"]["lat"],
de_longitude=node["location"]["coords"]["lon"],
)
@@ -99,7 +99,7 @@ class UKPacketNet(HTTPSpotProvider):
for spot in new_spots:
if spot.dx_call in nodes:
spot.dx_grid = (
nodes[spot.dx_call]["location"]["locator"] if "locator" in nodes[spot.dx_call]["location"] else None
nodes[spot.dx_call]["location"].get("locator", None)
)
spot.dx_latitude = nodes[spot.dx_call]["location"]["coords"]["lat"]
spot.dx_longitude = nodes[spot.dx_call]["location"]["coords"]["lon"]