Skip to content

Personal AI, On Personal Devices

Python

chore: restore green ruff lint on main (#435)

Jon Saad-Falconc8970cc3878b
diff --git a/pyproject.toml b/pyproject.toml
index 662ee26f..7041e8cc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -184,8 +184,13 @@ select = ["E", "F", "I", "W"]
"src/openjarvis/evals/datasets/*.py" = ["E501"]
"src/openjarvis/evals/scorers/*.py" = ["E501"]
# hybrid/ is research code with long prompt strings and paradigm-specific
-# config dicts — same relaxation as evals research code above.
-"src/openjarvis/agents/hybrid/*.py" = ["E501"]
+# config dicts — same relaxation as evals research code above. The ``**`` glob
+# also covers subpackages (e.g. hybrid/skillorchestra/), which the prior
+# ``hybrid/*.py`` glob missed.
+"src/openjarvis/agents/hybrid/**/*.py" = ["E501"]
+# research_loop.py carries long prompt strings too (documented in CLAUDE.md);
+# the ignore was missing here.
+"src/openjarvis/agents/research_loop.py" = ["E501"]
[dependency-groups]
dev = [
diff --git a/src/openjarvis/agents/hybrid/_energy.py b/src/openjarvis/agents/hybrid/_energy.py
index c99759c6..457c7c70 100644
--- a/src/openjarvis/agents/hybrid/_energy.py
+++ b/src/openjarvis/agents/hybrid/_energy.py
@@ -34,7 +34,6 @@ import threading
import time
from typing import List, Optional
-
_NVML_WARNED = False
diff --git a/src/openjarvis/agents/hybrid/mini_swe_agent.py b/src/openjarvis/agents/hybrid/mini_swe_agent.py
index 5be1597d..09a7d896 100644
--- a/src/openjarvis/agents/hybrid/mini_swe_agent.py
+++ b/src/openjarvis/agents/hybrid/mini_swe_agent.py
@@ -61,7 +61,6 @@ from openjarvis.agents.hybrid._prices import (
)
from openjarvis.core.registry import AgentRegistry
-
# Gemini's FunctionDeclaration.parameters expects a Schema-shaped dict (or
# Schema object) with capitalized type strings ("OBJECT", "STRING"). The
# OpenAI/Anthropic JSON-Schema lower-case form is silently dropped — the
@@ -257,7 +256,7 @@ def _run_bash(
try:
stdout_b, stderr_b = proc.communicate(timeout=10)
except subprocess.TimeoutExpired:
- stdout_b, stderr_b = b"", b"";
+ stdout_b, stderr_b = b"", b""
stdout_b = stdout_b or b""
stderr_b = stderr_b or b""
exit_code = -1
diff --git a/src/openjarvis/agents/hybrid/runner.py b/src/openjarvis/agents/hybrid/runner.py
index 7456f842..52a2f12a 100644
--- a/src/openjarvis/agents/hybrid/runner.py
+++ b/src/openjarvis/agents/hybrid/runner.py
@@ -26,7 +26,6 @@ import threading
import time
import traceback
from concurrent.futures import ThreadPoolExecutor, as_completed
-from concurrent.futures import TimeoutError as FuturesTimeoutError
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Dict, List, Optional
diff --git a/src/openjarvis/agents/hybrid/skillorchestra/prompts/__init__.py b/src/openjarvis/agents/hybrid/skillorchestra/prompts/__init__.py
index d8666767..d21ece18 100644
--- a/src/openjarvis/agents/hybrid/skillorchestra/prompts/__init__.py
+++ b/src/openjarvis/agents/hybrid/skillorchestra/prompts/__init__.py
@@ -7,24 +7,24 @@ Centralized prompts for:
"""
from .eval_orchestrator import (
+ SKILL_ANALYSIS_ORCHESTRATOR_PROMPT,
+ SKILL_ORCHESTRATOR_PROMPT,
build_skill_orchestrator_prompt,
format_baseline_tool_info,
- SKILL_ORCHESTRATOR_PROMPT,
- SKILL_ANALYSIS_ORCHESTRATOR_PROMPT,
)
from .learning import (
- SKILL_DISCOVERY_PROMPT,
AGENT_ORCHESTRATION_DISCOVERY_PROMPT,
- SKILL_IDENTIFICATION_PROMPT,
+ AGENT_ORCHESTRATION_MERGE_PROMPT,
+ AGENT_ORCHESTRATION_SPLIT_PROMPT,
+ FAILURE_DRIVEN_REFINEMENT_PROMPT,
MODE_INSIGHT_PROMPT,
PROFILE_SUMMARY_PROMPT,
- SKILL_SPLIT_PROMPT,
+ SKILL_DISCOVERY_PROMPT,
+ SKILL_IDENTIFICATION_PROMPT,
SKILL_MERGE_PROMPT,
- AGENT_ORCHESTRATION_SPLIT_PROMPT,
- AGENT_ORCHESTRATION_MERGE_PROMPT,
- FAILURE_DRIVEN_REFINEMENT_PROMPT,
+ SKILL_SPLIT_PROMPT,
)
-from .model_routing import SKILL_ANALYSIS_PROMPT, BASELINE_PROMPT
+from .model_routing import BASELINE_PROMPT, SKILL_ANALYSIS_PROMPT
__all__ = [
# Eval orchestrator
diff --git a/src/openjarvis/agents/hybrid/skillorchestra/prompts/eval_orchestrator.py b/src/openjarvis/agents/hybrid/skillorchestra/prompts/eval_orchestrator.py
index bc2549c0..75c2e609 100644
--- a/src/openjarvis/agents/hybrid/skillorchestra/prompts/eval_orchestrator.py
+++ b/src/openjarvis/agents/hybrid/skillorchestra/prompts/eval_orchestrator.py
@@ -34,7 +34,7 @@ SKILL_ORCHESTRATOR_PROMPT = """You are a skill-based orchestrator for multi-step
### Search Skills
{search_skills}
-### Code|Enhance Reasoning Skills
+### Code|Enhance Reasoning Skills
{reasoning_skills}
### Answer Skills
@@ -90,7 +90,7 @@ SKILL_ANALYSIS_ORCHESTRATOR_PROMPT = """You are a skill-based orchestrator for m
## Quick Reference: What You Need to Do
**CRITICAL REQUIREMENT**: Before making ANY tool call, you MUST:
-1. Inside <think>...</think>, analyze required skills and output in <skill_analysis> tags
+1. Inside <think>...</think>, analyze required skills and output in <skill_analysis> tags
2. Then choose the appropriate tool with the selected model based on the skill analysis.
**The context above may be long - scroll back to see the problem and context, then follow the instructions below.**
@@ -106,7 +106,7 @@ SKILL_ANALYSIS_ORCHESTRATOR_PROMPT = """You are a skill-based orchestrator for m
### Search Skills
{search_skills}
-### Reasoning Skills
+### Reasoning Skills
{reasoning_skills}
### Answer Skills
diff --git a/src/openjarvis/agents/hybrid/skillorchestra/stage_router.py b/src/openjarvis/agents/hybrid/skillorchestra/stage_router.py
index 20f0a2bf..55b9ba65 100644
--- a/src/openjarvis/agents/hybrid/skillorchestra/stage_router.py
+++ b/src/openjarvis/agents/hybrid/skillorchestra/stage_router.py
@@ -10,10 +10,8 @@ from __future__ import annotations
import json
import re
from dataclasses import dataclass, field
-from pathlib import Path
from typing import Any, Dict, List, Optional
-
# =============================================================================
# Handbook dataclasses (compatible with stage_router JSON)
# =============================================================================
diff --git a/src/openjarvis/agents/hybrid/skillorchestra/types.py b/src/openjarvis/agents/hybrid/skillorchestra/types.py
index f6fad550..ae741d91 100644
--- a/src/openjarvis/agents/hybrid/skillorchestra/types.py
+++ b/src/openjarvis/agents/hybrid/skillorchestra/types.py
@@ -14,10 +14,8 @@ from __future__ import annotations
import math
import uuid
from dataclasses import dataclass, field
-from datetime import datetime
from typing import Any, Dict, List, Optional
-
# ---------------------------------------------------------------------------
# BetaCompetence
# ---------------------------------------------------------------------------
@@ -419,4 +417,4 @@ class AgentProfile:
routing_signals=d.get("routing_signals", []),
strengths=d.get("strengths", []),
weaknesses=d.get("weaknesses", []),
- )
\ No newline at end of file
+ )
diff --git a/src/openjarvis/evals/scorers/swebench_harness.py b/src/openjarvis/evals/scorers/swebench_harness.py
index 96e55b72..415d8ff2 100644
--- a/src/openjarvis/evals/scorers/swebench_harness.py
+++ b/src/openjarvis/evals/scorers/swebench_harness.py
@@ -189,7 +189,9 @@ def _patch_modal_sandbox_source() -> None:
isn't — safe to run repeatedly. No-op if upstream ever fixes this.
"""
try:
- from swebench.harness.modal_eval import run_evaluation_modal as _m # type: ignore[import-not-found]
+ from swebench.harness.modal_eval import (
+ run_evaluation_modal as _m, # type: ignore[import-not-found]
+ )
except Exception:
return
src_path = getattr(_m, "__file__", None)
@@ -232,7 +234,9 @@ def _patch_modal_sandbox_write_file() -> None:
still letting real write failures (patch/eval script) surface.
"""
try:
- from swebench.harness.modal_eval import run_evaluation_modal as _m # type: ignore[import-not-found]
+ from swebench.harness.modal_eval import (
+ run_evaluation_modal as _m, # type: ignore[import-not-found]
+ )
except Exception:
return
runtime = getattr(_m, "ModalSandboxRuntime", None)
@@ -266,7 +270,9 @@ def _sentinel_present_on_disk() -> bool:
silently regress to the broken version.
"""
try:
- from swebench.harness.modal_eval import run_evaluation_modal as _m # type: ignore[import-not-found]
+ from swebench.harness.modal_eval import (
+ run_evaluation_modal as _m, # type: ignore[import-not-found]
+ )
except Exception:
return False
src_path = getattr(_m, "__file__", None)
diff --git a/src/openjarvis/speech/cartesia_tts.py b/src/openjarvis/speech/cartesia_tts.py
index 3b035c61..bec9b107 100644
--- a/src/openjarvis/speech/cartesia_tts.py
+++ b/src/openjarvis/speech/cartesia_tts.py
@@ -57,7 +57,9 @@ class CartesiaTTSBackend(TTSBackend):
backend_id = "cartesia"
- def __init__(self, *, api_key: str = "", model: str = "sonic", language: str = "en") -> None:
+ def __init__(
+ self, *, api_key: str = "", model: str = "sonic", language: str = "en"
+ ) -> None:
self._api_key = api_key or os.environ.get("CARTESIA_API_KEY", "")
self._model = model
self._language = language or os.environ.get("CARTESIA_LANGUAGE", "en")