diff --git a/ods/bin/ods-host-agent.py b/ods/bin/ods-host-agent.py
index 9615cbf940..ac44d73d04 100755
--- a/ods/bin/ods-host-agent.py
+++ b/ods/bin/ods-host-agent.py
@@ -11251,7 +11251,7 @@ def _capture_managed_opencode_state() -> dict:
return {"system": system, "active": False, "target": target}
raise RuntimeError(f"Could not inspect managed OpenCode: {detail[:300]}")
return {"system": system, "active": True, "target": target}
- elif system == "Linux":
+ if system == "Linux":
user_env = _opencode_user_service_env()
status = subprocess.run(
["systemctl", "--user", "is-active", "--quiet", "opencode-web.service"],
@@ -11266,7 +11266,7 @@ def _capture_managed_opencode_state() -> dict:
return {"system": system, "active": False, "env": user_env}
detail = (status.stderr or status.stdout or "").strip()
raise RuntimeError(f"Could not inspect managed OpenCode: {detail[:300]}")
- elif system == "Windows":
+ if system == "Windows":
return {"system": system, "active": _run_windows_opencode_control("inspect")}
return {"system": system, "active": False}
diff --git a/ods/extensions/services/dashboard-api/gpu.py b/ods/extensions/services/dashboard-api/gpu.py
index 947b923a16..6f5304c1c9 100644
--- a/ods/extensions/services/dashboard-api/gpu.py
+++ b/ods/extensions/services/dashboard-api/gpu.py
@@ -845,15 +845,13 @@ def get_gpu_tier(vram_gb: float, memory_type: str = "discrete") -> str:
if memory_type == "unified":
if vram_gb >= 90:
return "Strix Halo 90+"
- else:
- return "Strix Halo Compact"
+ return "Strix Halo Compact"
if vram_gb >= 80:
return "Professional"
- elif vram_gb >= 24:
+ if vram_gb >= 24:
return "Prosumer"
- elif vram_gb >= 16:
+ if vram_gb >= 16:
return "Standard"
- elif vram_gb >= 8:
+ if vram_gb >= 8:
return "Entry"
- else:
- return "Minimal"
+ return "Minimal"
diff --git a/ods/extensions/services/dashboard-api/helpers.py b/ods/extensions/services/dashboard-api/helpers.py
index 3b682a80c4..b6a06bf509 100644
--- a/ods/extensions/services/dashboard-api/helpers.py
+++ b/ods/extensions/services/dashboard-api/helpers.py
@@ -1060,7 +1060,7 @@ def get_cpu_metrics() -> dict:
_system = platform.system()
if _system == "Linux":
return _get_cpu_metrics_linux()
- elif _system == "Darwin":
+ if _system == "Darwin":
return _get_cpu_metrics_darwin()
return {"percent": 0, "temp_c": None}
@@ -1143,6 +1143,6 @@ def get_ram_metrics() -> dict:
_system = platform.system()
if _system == "Linux":
return _get_ram_metrics_linux()
- elif _system == "Darwin":
+ if _system == "Darwin":
return _get_ram_metrics_sysctl()
return {"used_gb": 0, "total_gb": 0, "percent": 0}
diff --git a/ods/extensions/services/dashboard-api/routers/privacy.py b/ods/extensions/services/dashboard-api/routers/privacy.py
index 7a6227df08..d8242ae3bc 100644
--- a/ods/extensions/services/dashboard-api/routers/privacy.py
+++ b/ods/extensions/services/dashboard-api/routers/privacy.py
@@ -106,8 +106,7 @@ async def get_privacy_shield_stats(api_key: str = Depends(verify_api_key)):
async with session.get(f"{shield_url}/stats", headers=headers) as resp:
if resp.status == 200:
return await resp.json()
- else:
- return {"error": "Privacy Shield not responding", "status": resp.status}
+ return {"error": "Privacy Shield not responding", "status": resp.status}
except (asyncio.TimeoutError, aiohttp.ClientError, OSError):
logger.exception("Cannot reach Privacy Shield")
return {"error": "Cannot reach Privacy Shield", "enabled": False}
diff --git a/ods/extensions/services/dashboard-api/routers/setup.py b/ods/extensions/services/dashboard-api/routers/setup.py
index 7a0f37c154..25efb540d0 100644
--- a/ods/extensions/services/dashboard-api/routers/setup.py
+++ b/ods/extensions/services/dashboard-api/routers/setup.py
@@ -218,9 +218,8 @@ async def chat(request: ChatRequest, api_key: str = Depends(verify_api_key)):
# Strip thinking model tags — content may contain ... blocks
response_text = re.sub(r'[\s\S]*?\s*', '', response_text).strip()
return {"response": response_text, "success": True}
- else:
- error_text = await resp.text()
- raise HTTPException(status_code=resp.status, detail=f"LLM error: {error_text}")
+ error_text = await resp.text()
+ raise HTTPException(status_code=resp.status, detail=f"LLM error: {error_text}")
except aiohttp.ClientError:
logger.exception("Cannot reach LLM backend")
raise HTTPException(status_code=503, detail="Cannot reach LLM backend")
diff --git a/ods/extensions/services/dashboard-api/routers/workflows.py b/ods/extensions/services/dashboard-api/routers/workflows.py
index dd4d5d14a6..985f09625c 100644
--- a/ods/extensions/services/dashboard-api/routers/workflows.py
+++ b/ods/extensions/services/dashboard-api/routers/workflows.py
@@ -215,9 +215,8 @@ async def enable_workflow(workflow_id: str, api_key: str = Depends(verify_api_ke
async with session.patch(f"{N8N_URL}/api/v1/workflows/{n8n_id}", headers=headers, json={"active": True}) as activate_resp:
activated = activate_resp.status == 200
return {"status": "success", "workflowId": workflow_id, "n8nId": n8n_id, "activated": activated, "message": f"{wf_info['name']} is now active!"}
- else:
- error_text = await resp.text()
- raise HTTPException(status_code=resp.status, detail=f"n8n API error: {error_text}")
+ error_text = await resp.text()
+ raise HTTPException(status_code=resp.status, detail=f"n8n API error: {error_text}")
except asyncio.TimeoutError:
raise HTTPException(status_code=504, detail="n8n workflow add timed out")
except aiohttp.ClientError as e:
@@ -249,9 +248,8 @@ async def _remove_workflow(workflow_id: str):
async with session.delete(f"{N8N_URL}/api/v1/workflows/{n8n_wf['id']}", headers=headers) as resp:
if resp.status in (200, 204):
return {"status": "success", "workflowId": workflow_id, "message": f"{wf_info['name']} has been removed"}
- else:
- error_text = await resp.text()
- raise HTTPException(status_code=resp.status, detail=f"n8n API error: {error_text}")
+ error_text = await resp.text()
+ raise HTTPException(status_code=resp.status, detail=f"n8n API error: {error_text}")
except asyncio.TimeoutError:
raise HTTPException(status_code=504, detail="n8n workflow remove timed out")
except aiohttp.ClientError as e:
@@ -300,8 +298,7 @@ async def workflow_executions(workflow_id: str, limit: int = 20, api_key: str =
if resp.status == 200:
data = await resp.json()
return {"workflowId": workflow_id, "n8nId": n8n_wf["id"], "executions": data.get("data", [])}
- else:
- return {"executions": [], "error": "Failed to fetch executions"}
+ return {"executions": [], "error": "Failed to fetch executions"}
except (aiohttp.ClientError, OSError, json.JSONDecodeError):
logger.exception("Failed to fetch workflow executions")
return {"executions": [], "error": "Failed to fetch executions"}
diff --git a/ods/extensions/services/dashboard-api/tests/test_talk.py b/ods/extensions/services/dashboard-api/tests/test_talk.py
index 5387ef49e2..befe04c4e2 100644
--- a/ods/extensions/services/dashboard-api/tests/test_talk.py
+++ b/ods/extensions/services/dashboard-api/tests/test_talk.py
@@ -76,7 +76,7 @@ def test_talk_message_rejects_incompatible_model_before_hermes(talk_client, monk
async def fake_submit(session_key, text):
calls.append((session_key, text))
- return None
+ return
monkeypatch.setattr("hermes_bridge.submit_prompt", fake_submit)
async def incompatible_model():
diff --git a/ods/extensions/services/token-spy/db_postgres.py b/ods/extensions/services/token-spy/db_postgres.py
index 0616df56a3..b8e4a4365a 100644
--- a/ods/extensions/services/token-spy/db_postgres.py
+++ b/ods/extensions/services/token-spy/db_postgres.py
@@ -221,13 +221,13 @@ def _detect_provider(model: str) -> str:
model_lower = model.lower()
if "claude" in model_lower:
return "anthropic"
- elif "kimi" in model_lower:
+ if "kimi" in model_lower:
return "moonshot"
- elif "gpt" in model_lower or "o1" in model_lower:
+ if "gpt" in model_lower or "o1" in model_lower:
return "openai"
- elif "gemini" in model_lower:
+ if "gemini" in model_lower:
return "google"
- elif "qwen" in model_lower:
+ if "qwen" in model_lower:
return "alibaba"
return "unknown"
diff --git a/ods/extensions/services/token-spy/main.py b/ods/extensions/services/token-spy/main.py
index 2d654da8c3..b736b066aa 100644
--- a/ods/extensions/services/token-spy/main.py
+++ b/ods/extensions/services/token-spy/main.py
@@ -691,11 +691,10 @@ async def proxy_messages(request: Request):
client, raw_body, forward_headers, model, sys_analysis, msg_analysis,
tools, start,
)
- else:
- return await _handle_non_streaming(
- client, raw_body, forward_headers, model, sys_analysis, msg_analysis,
- tools, start,
- )
+ return await _handle_non_streaming(
+ client, raw_body, forward_headers, model, sys_analysis, msg_analysis,
+ tools, start,
+ )
async def _handle_streaming(client, raw_body, headers, model, sys_analysis,
@@ -920,11 +919,10 @@ async def proxy_chat_completions(request: Request):
client, raw_body, forward_headers, model, sys_analysis, msg_analysis,
tools, start, filter_result=filter_result,
)
- else:
- return await _handle_openai_non_streaming(
- client, raw_body, forward_headers, model, sys_analysis, msg_analysis,
- tools, start, filter_result=filter_result,
- )
+ return await _handle_openai_non_streaming(
+ client, raw_body, forward_headers, model, sys_analysis, msg_analysis,
+ tools, start, filter_result=filter_result,
+ )
async def _handle_openai_streaming(client, raw_body, headers, model, sys_analysis,
diff --git a/ods/scripts/assign_gpus.py b/ods/scripts/assign_gpus.py
index 062d2375e1..1ab9c8dda2 100644
--- a/ods/scripts/assign_gpus.py
+++ b/ods/scripts/assign_gpus.py
@@ -356,16 +356,15 @@ def select_parallelism(subset: Subset) -> LlamaParallelism:
gpu_memory_utilization=0.92,
tensor_split=split,
)
- else:
- tp = largest_pow2_divisor(n)
- pp = n // tp
- return LlamaParallelism(
- mode="hybrid",
- tensor_parallel_size=tp,
- pipeline_parallel_size=pp,
- gpu_memory_utilization=0.93,
- tensor_split=split,
- )
+ tp = largest_pow2_divisor(n)
+ pp = n // tp
+ return LlamaParallelism(
+ mode="hybrid",
+ tensor_parallel_size=tp,
+ pipeline_parallel_size=pp,
+ gpu_memory_utilization=0.93,
+ tensor_split=split,
+ )
# Cross-NUMA PCIe
if rank <= 10:
@@ -384,24 +383,22 @@ def select_parallelism(subset: Subset) -> LlamaParallelism:
pipeline_parallel_size=n,
gpu_memory_utilization=0.95,
)
- else:
- if rank >= 40:
- tp = largest_pow2_divisor(n)
- pp = n // tp
- return LlamaParallelism(
- mode="hybrid",
- tensor_parallel_size=tp,
- pipeline_parallel_size=pp,
- gpu_memory_utilization=0.93,
- tensor_split=split,
- )
- else:
- return LlamaParallelism(
- mode="pipeline",
- tensor_parallel_size=1,
- pipeline_parallel_size=n,
- gpu_memory_utilization=0.95,
- )
+ if rank >= 40:
+ tp = largest_pow2_divisor(n)
+ pp = n // tp
+ return LlamaParallelism(
+ mode="hybrid",
+ tensor_parallel_size=tp,
+ pipeline_parallel_size=pp,
+ gpu_memory_utilization=0.93,
+ tensor_split=split,
+ )
+ return LlamaParallelism(
+ mode="pipeline",
+ tensor_parallel_size=1,
+ pipeline_parallel_size=n,
+ gpu_memory_utilization=0.95,
+ )
# Phase 4: Build Output JSON