mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
More ruff linter fixes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user