Fix CI lint failures so build-push can run and push an image
Some checks failed
build / build-push (push) Blocked by required conditions
build / lint-test (push) Failing after 6s

ruff: drop stale SLF001 noqa, wrap json.load in a context manager (SIM115), remove unused imports + placeholder-less f-strings; ignore PLR0912/PLR0915 for one-off scripts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
kianiadee 2026-05-29 01:11:19 +03:00
parent 1fc83dcac9
commit cf747d3efe
3 changed files with 10 additions and 6 deletions

View file

@ -82,7 +82,7 @@ def _truncate_sample(payload: Any) -> dict[str, Any] | None:
async def _check_token(client: TracksolidClient, *, parser_version: str) -> None:
try:
await client._ensure_token() # noqa: SLF001 — intentional probe
await client._ensure_token() # intentional probe of the token endpoint
except (TracksolidError, httpx.HTTPError) as exc:
await _record(
endpoint=TOKEN_METHOD,

View file

@ -47,6 +47,9 @@ ignore = ["PLR0913", "PLR2004"]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["PLR0913", "PLR2004"]
# One-off operational/analysis scripts: allow the long, branchy simulation
# routines that mirror the SQL trip state machine.
"scripts/*" = ["PLR0912", "PLR0915"]
[tool.mypy]
python_version = "3.12"

View file

@ -19,8 +19,8 @@ from __future__ import annotations
import json
import math
import sys
from collections import Counter, defaultdict
from dataclasses import dataclass, field
from collections import defaultdict
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any
@ -205,19 +205,20 @@ def legacy_summary(rows: list[dict[str, Any]]) -> dict[str, Any]:
def main(path: str) -> None:
rows = json.load(open(path))
with open(path) as f:
rows = json.load(f)
print(f"\n=== {path} ===")
print(f"raw rows: {len(rows)}")
leg = legacy_summary(rows)
print(f"\n-- LEGACY --")
print("\n-- LEGACY --")
print(f"trips: {len(leg['trips'])} (plus {leg['n_stationary_rows']} stationary-bucket rows)")
for tid, t0, t1, n in leg["trips"]:
dur = (t1 - t0).total_seconds() / 60
print(f" trip {tid}: {t0:%H:%M:%S}{t1:%H:%M:%S} ({dur:.0f} min, {n} fixes)")
sim = simulate(rows)
print(f"\n-- NEW ALGO (5min stop, 30min gap, 5 km/h stationary) --")
print("\n-- NEW ALGO (5min stop, 30min gap, 5 km/h stationary) --")
rep = sim["reporting_time"]
print(f"reporting_time: {rep.isoformat() if rep else 'none'}")
print(f"day totals: distance={sim['total_distance_km']} km, "