chore(lint): auto-fix 253 of 283 ruff issues (F401, I001, E402, RUF100, UP037, SIM105)
Mass ruff auto-fix:
- ruff check --fix: 109 issues fixed (F401 unused imports,
I001 unsorted imports, UP037 quoted annotations, SIM105
suppressible exception, RUF100 unused-noqa)
- ruff check --fix --unsafe-fixes: 22 additional issues
- ruff format: 70 files reformatted
- Manual pass: fix 16 misplaced import httpx lines
- Manual pass: fix remaining E402 (import-after-docstring)
Result: 283 errors -> 30 errors.
The remaining 30 are real issues that need manual review:
5 F401 unused-import (likely auto-generated stubs)
5 F821 undefined-name (real bugs in code that references
redis/pydantic/LLMRegistry without imports)
3 BLE001 (the compliance LLM fallback is intentional; the
other two are real)
3 RUF012 mutable-class-default
3 SIM105, 3 SIM117, 2 E722, 2 E741
1 B007, 1 B025, 1 E402, 1 RUF200 (pyproject.toml issue)
Tests: 436/437 pass (1 pre-existing SSE sandbox failure).
format check + import sort: now clean.
make ci: still gated on the 30 remaining real issues.
Follow-up: triage the 30 issues file-by-file.
This commit is contained in:
parent
e60a62a07a
commit
a7c30b12cd
85 changed files with 2374 additions and 1071 deletions
10
anomaly.py
10
anomaly.py
|
|
@ -82,7 +82,9 @@ class AnomalyDetector:
|
|||
if isinstance(v, (int, float)) and not isinstance(v, bool):
|
||||
common.add(k)
|
||||
for r in records[1:]:
|
||||
rkeys = {k for k, v in r.items() if isinstance(v, (int, float)) and not isinstance(v, bool)}
|
||||
rkeys = {
|
||||
k for k, v in r.items() if isinstance(v, (int, float)) and not isinstance(v, bool)
|
||||
}
|
||||
common &= rkeys
|
||||
return list(common)
|
||||
|
||||
|
|
@ -139,16 +141,14 @@ class AnomalyDetector:
|
|||
if current_dow in dow_values and len(dow_values[current_dow]) >= 2:
|
||||
dow_mean = statistics.mean(dow_values[current_dow])
|
||||
dow_stdev = (
|
||||
statistics.stdev(dow_values[current_dow])
|
||||
if len(dow_values[current_dow]) > 1
|
||||
else 0
|
||||
statistics.stdev(dow_values[current_dow]) if len(dow_values[current_dow]) > 1 else 0
|
||||
)
|
||||
if dow_stdev > 0 and abs((current - dow_mean) / dow_stdev) < 1.5:
|
||||
return {
|
||||
"seasonal_anomaly": False,
|
||||
"seasonal_explanation": (
|
||||
f"Value fits "
|
||||
f"{['Mon','Tue','Wed','Thu','Fri','Sat','Sun'][current_dow]} pattern"
|
||||
f"{['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][current_dow]} pattern"
|
||||
),
|
||||
}
|
||||
if context.get("is_promotional"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue