chore: remove dead code — 28 unused functions/classes across 16 files
Vulture + per-symbol verification (whole-repo grep incl. tests, string literals, getattr, decorator/registry/argparse dispatch) confirmed each of these has zero callers anywhere — not reachable via any dynamic-dispatch path, not referenced by tests, not re-exported. Removed: - acp_adapter/tools.py: _build_patch_mode_content - agent/anthropic_adapter.py: read_claude_managed_key (diagnostics-only, never called) - agent/bedrock_adapter.py: get_bedrock_model_ids - agent/browser_registry.py: get_active_browser_provider - agent/chat_completion_helpers.py: _take_request_client (x2 nested closures, never invoked) - gateway/platforms/weixin.py: _rewrite_headers_for_weixin, _rewrite_table_block_for_weixin - hermes_cli/banner.py: _skin_branding - hermes_cli/debug.py: _delete_hint - hermes_cli/gateway.py: _setup_email, _setup_sms, _setup_yuanbao (platform keys absent from the _builtin_setup_fn dispatch dict; handled by the _setup_standard_platform fallback) - hermes_cli/kanban_db.py: set_max_runtime, active_run - hermes_cli/kanban_diagnostics.py: severity_of_highest, _latest_clean_event_ts - hermes_cli/main.py: _build_provider_choices, cmd_portal (portal subcommand is wired via portal_cli.add_parser, not this wrapper) - hermes_cli/model_switch.py: CustomAutoResult (orphaned by the switch_model() extraction) - hermes_cli/models.py: format_model_pricing_table, fetch_nous_account_tier - hermes_cli/portal_cli.py: _nous_portal_base_url - hermes_cli/proxy/server.py: handle_models_fallback (defined but never registered on the router) - tools/computer_use/cua_backend.py: _parse_element, _is_arm_mac - tools/file_operations.py: _get_safe_write_root (prod uses the imported agent.file_safety.get_safe_write_root directly) - tools/skills_tool.py: _load_category_description Also dropped two imports left unused by the removals: - tools/file_operations.py: get_safe_write_root alias - tools/computer_use/cua_backend.py: import platform Pure deletion: -551 LOC. No behavior change. Test files covering the edited modules pass (640/640); the broader suite's pre-existing/env-dependent failures reproduce unchanged on origin/main.
This commit is contained in:
@@ -22,7 +22,6 @@ import base64
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
@@ -77,12 +76,6 @@ _ELEMENT_LINE_RE = re.compile(
|
||||
|
||||
def _is_macos() -> bool:
|
||||
return sys.platform == "darwin"
|
||||
|
||||
|
||||
def _is_arm_mac() -> bool:
|
||||
return _is_macos() and platform.machine() == "arm64"
|
||||
|
||||
|
||||
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))
|
||||
@@ -705,29 +698,3 @@ class CuaDriverBackend(ComputerUseBackend):
|
||||
message = data
|
||||
return ActionResult(ok=ok, action=name, message=message,
|
||||
meta=data if isinstance(data, dict) else {})
|
||||
|
||||
|
||||
def _parse_element(d: Dict[str, Any]) -> UIElement:
|
||||
bounds = d.get("bounds") or (0, 0, 0, 0)
|
||||
if isinstance(bounds, dict):
|
||||
bounds = (
|
||||
int(bounds.get("x", 0)),
|
||||
int(bounds.get("y", 0)),
|
||||
int(bounds.get("w", bounds.get("width", 0))),
|
||||
int(bounds.get("h", bounds.get("height", 0))),
|
||||
)
|
||||
elif isinstance(bounds, (list, tuple)) and len(bounds) == 4:
|
||||
bounds = tuple(int(v) for v in bounds)
|
||||
else:
|
||||
bounds = (0, 0, 0, 0)
|
||||
return UIElement(
|
||||
index=int(d.get("index", 0)),
|
||||
role=str(d.get("role", "") or ""),
|
||||
label=str(d.get("label", "") or ""),
|
||||
bounds=bounds, # type: ignore[arg-type]
|
||||
app=str(d.get("app", "") or ""),
|
||||
pid=int(d.get("pid", 0) or 0),
|
||||
window_id=int(d.get("windowId", 0) or 0),
|
||||
attributes={k: v for k, v in d.items()
|
||||
if k not in {"index", "role", "label", "bounds", "app", "pid", "windowId"}},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user