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.
This commit is contained in:
@ -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/")):
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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] = []
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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():
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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).
|
||||
|
||||
Reference in New Issue
Block a user