style: clear all 23 pre-existing ruff lint errors
Master had been failing CI lint since before this PR. Knock out the backlog so the parallel-queue PR can ship green and future PRs don't inherit the red baseline. Changes by category: - UP042 (9): Migrate `class Foo(str, Enum)` to `class Foo(StrEnum)` in tensors/config.py (7 enums) and tensors/server/search_routes.py (2). Requires Python 3.11+, already enforced by `requires-python = ">=3.12"`. - PLR2004 (3): Extract magic comparison values in comfyui_api_routes.py to module-level constants (_DEFAULT_STEPS, _DEFAULT_CFG, _PROMPT_LOG_TRUNCATE). - PLW0108 (2): Inline `lambda: StubDB()` -> `StubDB` in test_server.py. - PLR0915 (3): Add explicit `# noqa: PLR0915` to typer command bodies that are intentionally long (template, templates_extract, _wait_for_completion_ws). - PLR1714 (1): `file_path.name == model or file_path.stem == model` -> `model in (file_path.name, file_path.stem)` in cli.py:3047. - SIM113 (1): Use `enumerate(as_completed(futures), start=1)` for the completion counter in style-sweep parallel loop. - RUF059 (1): Prefix unused tuple-unpacked vars with `_` in _run_one. - SIM105 (1): `try: ws.close() except Exception: pass` -> `contextlib.suppress(Exception)` in comfyui.py. - PLC0415 (1): Add missing `# noqa: PLC0415` to the second of two function-scoped tensors.config imports. No behavior changes. All 374 tests still pass.
This commit is contained in:
@@ -1237,7 +1237,7 @@ class TestDownloadBackgroundTasks:
|
||||
captured["api_key"] = api_key
|
||||
return {"file_id": 42, "sha256": "deadbeef", "linked": True, "cached": True, "error": None}
|
||||
|
||||
monkeypatch.setattr(download_routes_module, "Database", lambda: StubDB())
|
||||
monkeypatch.setattr(download_routes_module, "Database", StubDB)
|
||||
return captured
|
||||
|
||||
def test_do_download_success(self, monkeypatch, tmp_path) -> None:
|
||||
@@ -1397,7 +1397,7 @@ class TestDownloadBackgroundTasks:
|
||||
def register_downloaded_file(self, *args, **kwargs):
|
||||
return {"file_id": None, "sha256": None, "linked": False, "cached": False, "error": "boom"}
|
||||
|
||||
monkeypatch.setattr(download_routes, "Database", lambda: FailingDB())
|
||||
monkeypatch.setattr(download_routes, "Database", FailingDB)
|
||||
|
||||
dest_path = tmp_path / "model.safetensors"
|
||||
_do_download(12345, dest_path, None, download_id, {"id": 1, "modelId": 1})
|
||||
|
||||
Reference in New Issue
Block a user