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
+8 -7
View File
@@ -4,6 +4,7 @@ import logging
import re
from dataclasses import dataclass
from datetime import datetime, timedelta
from math import isnan
import pytz
from pyhamtools.locator import latlong_to_locator, locator_to_latlong
@@ -229,7 +230,7 @@ class Spot:
self.de_flag = get_flag_for_dxcc(self.de_dxcc_id)
# Remove NaNs in frequency
if self.freq and self.freq == float("nan"):
if self.freq and isnan(self.freq):
self.freq = None
# Band from frequency
@@ -364,12 +365,12 @@ class Spot:
ll = locator_to_latlong(self.dx_grid)
self.dx_latitude = ll[0]
self.dx_longitude = ll[1]
except:
except Exception:
logger.debug("Invalid grid received for spot")
if self.dx_latitude and self.dx_longitude and not self.dx_grid:
try:
self.dx_grid = latlong_to_locator(self.dx_latitude, self.dx_longitude, 8)
except:
except Exception:
logger.debug("Invalid lat/lon received for spot")
# QRT comment detection
@@ -438,12 +439,12 @@ class Spot:
self.de_call
and any(char.isdigit() for char in str(self.de_call))
and not (self.de_call.startswith("T2") and self.source == "APRS-IS")
and not self.de_latitude
):
# DE operator location lookup
if not self.de_latitude:
self.de_latitude = de_call_info.latitude
self.de_longitude = de_call_info.longitude
self.de_grid = de_call_info.grid
self.de_latitude = de_call_info.latitude
self.de_longitude = de_call_info.longitude
self.de_grid = de_call_info.grid
except Exception:
logger.exception("Exception while inferring missing data from spot")