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
+3 -3
View File
@@ -150,7 +150,7 @@ def get_alert_list_with_filters(all_alerts, query):
alerts.append(a)
alerts = sorted(alerts, key=lambda alert: alert.start_time if alert and alert.start_time else 0)
alerts = list(filter(lambda alert: alert_allowed_by_query(alert, query), alerts))
if "limit" in query.keys():
if "limit" in query:
alerts = alerts[: int(query.get("limit"))]
return alerts
@@ -159,7 +159,7 @@ def alert_allowed_by_query(alert, query):
"""Given URL query params and an alert, figure out if the alert "passes" the requested filters or is rejected. The list
of query parameters and their function is defined in the API docs."""
for k in query.keys():
for k in query:
match k:
case "received_since":
since = datetime.fromtimestamp(float(query.get(k)), pytz.UTC)
@@ -172,7 +172,7 @@ def alert_allowed_by_query(alert, query):
# the alert is a dxpedition, it also always passes the check.
if alert.is_dxpedition and (
query.get("dxpeditions_skip_max_duration_check").upper() == "TRUE"
if "dxpeditions_skip_max_duration_check" in query.keys()
if "dxpeditions_skip_max_duration_check" in query
else False
):
continue