Ruff-Cleanup: ganzes MC2-Repo lint-grün + projekt-passende ruff.toml

Die Ampel-Nachruestung deckte 317/337 vorbestehende ruff-Verstoesse im ganzen Repo
auf. Aufgeraeumt:
- ruff.toml: intentionale Muster als Projekt-Politik ausgenommen (BLE001 blind-except,
  S110/S112 try-except-pass/continue, PLW1510 subprocess-best-effort, B008 FastAPI-
  Depends/File-Idiom, EXE001 Shebang, + wenige Stil-Regeln). __init__.py-Re-Exports
  geschuetzt (F401).
- ruff --fix: 128 mechanische (Import-Sortierung, PEP585/604-Annotationen, tote Imports,
  ueberfluessige noqa) auto-behoben.
- 12 echte Reste von Hand: PERF402/102, PLC3002 (Lambda->walrus), ISC004 (String-Concat
  geklammert), F841/RUF059 (ungenutzte Vars), PIE810 (startswith-Tuple), UP031 (f-string),
  UP035 (veraltete typing-Imports).
Ergebnis: 'ruff check .' = 0, 'compileall' grün. Kein Verhaltenswechsel (nur Stil/Modernisierung).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-07-24 20:53:36 +02:00
parent e6502f676a
commit 47f7a85510
58 changed files with 174 additions and 171 deletions
+4 -4
View File
@@ -23,7 +23,7 @@ import sys
_TASK_RE = re.compile(rb"work kanban task (t_[0-9a-fA-F]+)")
def reap_orphaned_workers(connect_closing) -> "list[tuple[int, str]]":
def reap_orphaned_workers(connect_closing) -> list[tuple[int, str]]:
"""Beende lebende Kanban-Worker, deren Task nicht mehr ``running`` ist.
``connect_closing`` ist die gleichnamige Kontextmanager-Factory aus
@@ -32,7 +32,7 @@ def reap_orphaned_workers(connect_closing) -> "list[tuple[int, str]]":
"""
if sys.platform != "linux":
return []
candidates: "dict[int, str]" = {}
candidates: dict[int, str] = {}
try:
entries = os.listdir("/proc")
except OSError:
@@ -53,7 +53,7 @@ def reap_orphaned_workers(connect_closing) -> "list[tuple[int, str]]":
task_ids = list(set(candidates.values()))
placeholders = ",".join("?" * len(task_ids))
running: "set[str]" = set()
running: set[str] = set()
try:
with connect_closing() as conn:
running = {
@@ -67,7 +67,7 @@ def reap_orphaned_workers(connect_closing) -> "list[tuple[int, str]]":
except Exception:
return []
killed: "list[tuple[int, str]]" = []
killed: list[tuple[int, str]] = []
for pid, task_id in candidates.items():
if task_id in running:
continue