From ddaf2f671226a97aea9d5cb32ae011186ce0f457 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Fri, 29 May 2026 04:10:07 -0700 Subject: [PATCH] style: restore PEP8 blank-line separation after dead-code removal The deletions in the salvaged commit left some top-level defs/classes separated by a single blank line. Restore the 2-blank-line separation. --- acp_adapter/tools.py | 2 ++ agent/anthropic_adapter.py | 2 ++ agent/browser_registry.py | 2 ++ gateway/platforms/weixin.py | 2 ++ hermes_cli/debug.py | 2 ++ hermes_cli/gateway.py | 4 ++++ hermes_cli/kanban_db.py | 4 ++++ hermes_cli/main.py | 2 ++ hermes_cli/models.py | 2 ++ hermes_cli/portal_cli.py | 2 ++ tools/computer_use/cua_backend.py | 2 ++ tools/file_operations.py | 2 ++ tools/skills_tool.py | 2 ++ 13 files changed, 30 insertions(+) diff --git a/acp_adapter/tools.py b/acp_adapter/tools.py index c963c6bcc..b913e1043 100644 --- a/acp_adapter/tools.py +++ b/acp_adapter/tools.py @@ -905,6 +905,8 @@ def _build_polished_completion_content( if not text: return None return [_text(text)] + + def _strip_diff_prefix(path: str) -> str: raw = str(path or "").strip() if raw.startswith(("a/", "b/")): diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py index 7ac7b8df4..d9bbe2d8e 100644 --- a/agent/anthropic_adapter.py +++ b/agent/anthropic_adapter.py @@ -892,6 +892,8 @@ def read_claude_code_credentials() -> Optional[Dict[str, Any]]: logger.debug("Failed to read ~/.claude/.credentials.json: %s", e) return None + + def is_claude_code_token_valid(creds: Dict[str, Any]) -> bool: """Check if Claude Code credentials have a non-expired access token.""" import time diff --git a/agent/browser_registry.py b/agent/browser_registry.py index 4d0760203..122eab4e5 100644 --- a/agent/browser_registry.py +++ b/agent/browser_registry.py @@ -184,6 +184,8 @@ def _resolve(configured: Optional[str]) -> Optional[BrowserProvider]: return provider return None + + def _reset_for_tests() -> None: """Clear the registry. **Test-only.**""" with _lock: diff --git a/gateway/platforms/weixin.py b/gateway/platforms/weixin.py index 03dc4c7f1..26a8efd5b 100644 --- a/gateway/platforms/weixin.py +++ b/gateway/platforms/weixin.py @@ -656,6 +656,8 @@ def _split_table_row(line: str) -> List[str]: if row.endswith("|"): row = row[:-1] return [cell.strip() for cell in row.split("|")] + + def _normalize_markdown_blocks(content: str) -> str: lines = content.splitlines() result: List[str] = [] diff --git a/hermes_cli/debug.py b/hermes_cli/debug.py index 7964a85b9..e3f2306f6 100644 --- a/hermes_cli/debug.py +++ b/hermes_cli/debug.py @@ -256,6 +256,8 @@ def _schedule_auto_delete(urls: list[str], delay_seconds: int = _AUTO_DELETE_SEC policy handles cleanup. """ _record_pending(urls, delay_seconds=delay_seconds) + + def _upload_paste_rs(content: str) -> str: """Upload to paste.rs. Returns the paste URL. diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py index 88f0c8122..e90f5f9cc 100644 --- a/hermes_cli/gateway.py +++ b/hermes_cli/gateway.py @@ -3958,6 +3958,8 @@ def _setup_whatsapp(): from hermes_cli.main import cmd_whatsapp import argparse cmd_whatsapp(argparse.Namespace()) + + def _setup_dingtalk(): """Configure DingTalk — QR scan (recommended) or manual credential entry.""" from hermes_cli.setup import ( @@ -4128,6 +4130,8 @@ def _setup_wecom(): print() print_success("💬 WeCom configured!") + + def _is_service_installed() -> bool: """Check if the gateway is installed as a system service.""" if supports_systemd_services(): diff --git a/hermes_cli/kanban_db.py b/hermes_cli/kanban_db.py index ab4ff8045..5e465e87a 100644 --- a/hermes_cli/kanban_db.py +++ b/hermes_cli/kanban_db.py @@ -4863,6 +4863,8 @@ def detect_stale_running( # spawn_failed / timed_out / crashed counters. return reclaimed + + def _error_fingerprint(error_text: str) -> str: """Normalize an error message for grouping identical failures. @@ -6948,6 +6950,8 @@ def get_run(conn: sqlite3.Connection, run_id: int) -> Optional[Run]: "SELECT * FROM task_runs WHERE id = ?", (int(run_id),), ).fetchone() return Run.from_row(row) if row else None + + def latest_run(conn: sqlite3.Connection, task_id: str) -> Optional[Run]: """Return the most recent run regardless of outcome (active or closed).""" row = conn.execute( diff --git a/hermes_cli/main.py b/hermes_cli/main.py index efb4f289f..7b3fb14b1 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -6158,6 +6158,8 @@ def cmd_webhook(args): from hermes_cli.webhook import webhook_command webhook_command(args) + + def cmd_slack(args): """Slack integration helpers. diff --git a/hermes_cli/models.py b/hermes_cli/models.py index ef81b5102..51088e8e3 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -1186,6 +1186,8 @@ def _format_price_per_mtok(per_token_str: str) -> str: return "free" per_m = val * 1_000_000 return f"${per_m:.2f}" + + def fetch_models_with_pricing( api_key: str | None = None, base_url: str = "https://openrouter.ai/api", diff --git a/hermes_cli/portal_cli.py b/hermes_cli/portal_cli.py index 61de0be73..bf257ae72 100644 --- a/hermes_cli/portal_cli.py +++ b/hermes_cli/portal_cli.py @@ -20,6 +20,8 @@ from hermes_cli.config import load_config DEFAULT_PORTAL_URL = "https://portal.nousresearch.com" SUBSCRIPTION_URL = "https://portal.nousresearch.com/manage-subscription" DOCS_URL = "https://hermes-agent.nousresearch.com/docs/user-guide/features/tool-gateway" + + def _cmd_status(args) -> int: """Show Portal auth + Tool Gateway routing summary.""" from hermes_cli.auth import get_nous_auth_status diff --git a/tools/computer_use/cua_backend.py b/tools/computer_use/cua_backend.py index c197b366e..714ae6d32 100644 --- a/tools/computer_use/cua_backend.py +++ b/tools/computer_use/cua_backend.py @@ -76,6 +76,8 @@ _ELEMENT_LINE_RE = re.compile( def _is_macos() -> bool: return sys.platform == "darwin" + + def cua_driver_binary_available() -> bool: """True if `cua-driver` is on $PATH or HERMES_CUA_DRIVER_CMD resolves.""" return bool(shutil.which(_CUA_DRIVER_CMD)) diff --git a/tools/file_operations.py b/tools/file_operations.py index 29d8fed8b..b27405c58 100644 --- a/tools/file_operations.py +++ b/tools/file_operations.py @@ -111,6 +111,8 @@ def _normalize_line_endings(text: str, target: str) -> str: if target == "\r\n": return lf_normalized.replace("\n", "\r\n") return text + + def _is_write_denied(path: str) -> bool: """Return True if path is on the write deny list.""" return _shared_is_write_denied(path) diff --git a/tools/skills_tool.py b/tools/skills_tool.py index c751fb456..bc19ff8b5 100644 --- a/tools/skills_tool.py +++ b/tools/skills_tool.py @@ -627,6 +627,8 @@ def _find_all_skills(*, skip_disabled: bool = False) -> List[Dict[str, Any]]: def _sort_skills(skills: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Keep every skill listing path ordered the same way.""" return sorted(skills, key=lambda s: (s.get("category") or "", s["name"])) + + def skills_list(category: str = None, task_id: str = None) -> str: """ List all available skills (progressive disclosure tier 1 - minimal metadata).