mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
fix: ruff lint errors across hanzo-tools-* packages (I001, F401, F541)
Fix 21 auto-fixable errors: import sorting (I001), unused import (F401), and empty f-strings (F541) in 13 files across tool packages.
This commit is contained in:
@@ -22,11 +22,11 @@ import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Core tools
|
||||
from .zen_tool import ZenTool
|
||||
from .agent_tool import AgentTool
|
||||
|
||||
# Legacy imports for backwards compatibility
|
||||
from .critic_tool import CriticTool # Legacy - use reasoning.critic instead
|
||||
from .zen_tool import ZenTool
|
||||
from .review_tool import ReviewTool
|
||||
from .grok_cli_tool import GrokCLITool
|
||||
from .cli_agent_base import CLIAgentBase
|
||||
|
||||
@@ -36,7 +36,6 @@ MCP Tool Usage:
|
||||
# Models (structured data types)
|
||||
# MCP Tool
|
||||
from .api_tool import APITool
|
||||
from .hanzo_tool import HanzoTool
|
||||
|
||||
# Main client (typed interface)
|
||||
from .client import (
|
||||
@@ -64,6 +63,7 @@ from .errors import (
|
||||
SpecNotLoadedError,
|
||||
ValidationError,
|
||||
)
|
||||
from .hanzo_tool import HanzoTool
|
||||
from .models import (
|
||||
APICallResult,
|
||||
AuthType,
|
||||
|
||||
@@ -10,7 +10,7 @@ from __future__ import annotations
|
||||
import importlib
|
||||
import inspect
|
||||
import json
|
||||
from typing import Any, Annotated, final, override
|
||||
from typing import Annotated, Any, final, override
|
||||
|
||||
from mcp.server import FastMCP
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
@@ -13,9 +13,9 @@ from hanzo_tools.api import (
|
||||
PROVIDER_CONFIGS,
|
||||
APIClient,
|
||||
APITool,
|
||||
HanzoTool,
|
||||
Credential,
|
||||
CredentialManager,
|
||||
HanzoTool,
|
||||
OpenAPIClient,
|
||||
SpecCache,
|
||||
)
|
||||
|
||||
@@ -22,12 +22,12 @@ from hanzo_tools.browser.browser_tool import (
|
||||
PLAYWRIGHT_AVAILABLE,
|
||||
BrowserPool,
|
||||
BrowserTool,
|
||||
browser_tool,
|
||||
create_browser_tool,
|
||||
get_backend,
|
||||
launch_browser_server,
|
||||
_load_config,
|
||||
_save_config,
|
||||
browser_tool,
|
||||
create_browser_tool,
|
||||
launch_browser_server,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -677,7 +677,7 @@ class BrowserTool(BaseTool):
|
||||
# and be preferred over Playwright when backend != "playwright".
|
||||
if self.backend != "playwright":
|
||||
try:
|
||||
from hanzo_tools.browser import start_cdp_bridge, CDP_BRIDGE_AVAILABLE
|
||||
from hanzo_tools.browser import CDP_BRIDGE_AVAILABLE, start_cdp_bridge
|
||||
if CDP_BRIDGE_AVAILABLE:
|
||||
start_cdp_bridge()
|
||||
except Exception:
|
||||
@@ -848,7 +848,7 @@ CATEGORIES:
|
||||
"observe_mutations", "computed_styles", "bounding_rects",
|
||||
"inject_script", "inject_css",
|
||||
"local_storage", "cookies",
|
||||
"tabs", "new_tab", "close_tab", "select_tab",
|
||||
"tabs", "new_tab", "select_tab",
|
||||
"console", "network_requests", "status",
|
||||
# Takeover actions (Phase 3)
|
||||
"takeover", "release",
|
||||
|
||||
@@ -31,8 +31,8 @@ import time
|
||||
import uuid
|
||||
import asyncio
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Optional
|
||||
from pathlib import Path
|
||||
from dataclasses import field, dataclass
|
||||
|
||||
try:
|
||||
|
||||
@@ -37,15 +37,15 @@ Screen Limits (configurable via env vars):
|
||||
|
||||
from hanzo_tools.core import BaseTool, ToolRegistry, PermissionManager
|
||||
|
||||
# HIP-0300: Single unified 'computer' tool
|
||||
from .computer_tool import ComputerTool
|
||||
# Backward compat
|
||||
from .ui_tool import UiTool, ui_tool
|
||||
|
||||
# Internal utilities (used by screen_tool)
|
||||
from .media_tool import MediaLimits, MediaResult, ActivitySegment, media_tool
|
||||
from .screen_tool import ScreenTool, ScreenConfig, screen_tool
|
||||
|
||||
# Backward compat
|
||||
from .ui_tool import UiTool, ui_tool
|
||||
# HIP-0300: Single unified 'computer' tool
|
||||
from .computer_tool import ComputerTool
|
||||
|
||||
# Export list for tool discovery - single computer tool (HIP-0300)
|
||||
TOOLS = [ComputerTool]
|
||||
|
||||
@@ -6,12 +6,12 @@ Actions: detect, capabilities, help, schema
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
import asyncio
|
||||
from typing import Any, ClassVar
|
||||
from pathlib import Path
|
||||
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ from hanzo_tools.shell.uvx_tool import UvxTool, uvx_tool
|
||||
# HTTP/Data tools (no shell escaping issues)
|
||||
from hanzo_tools.shell.curl_tool import CurlTool
|
||||
|
||||
# Convenience tools
|
||||
from hanzo_tools.shell.open_tool import OpenTool, open_tool
|
||||
|
||||
# HIP-0300: Unified exec tool
|
||||
from hanzo_tools.shell.exec_tool import ExecTool, exec_tool
|
||||
|
||||
# Convenience tools
|
||||
from hanzo_tools.shell.open_tool import OpenTool, open_tool
|
||||
from hanzo_tools.shell.shellflow import (
|
||||
parse as parse_shellflow,
|
||||
compile as compile_shellflow,
|
||||
|
||||
@@ -26,12 +26,12 @@ Usage:
|
||||
|
||||
from hanzo_tools.core import BaseTool, ToolRegistry
|
||||
|
||||
from .ui_tool import UiTool, ui_tool
|
||||
from .github_api import (
|
||||
FRAMEWORK_CONFIGS,
|
||||
FRAMEWORK_NAMES,
|
||||
GitHubAPIClient,
|
||||
)
|
||||
from .ui_tool import UiTool, ui_tool
|
||||
|
||||
TOOLS = [UiTool]
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Actions:
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from typing import Any, ClassVar
|
||||
from typing import ClassVar
|
||||
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
@@ -321,12 +321,12 @@ Frameworks: hanzo (default), hanzo-native, hanzo-vue, hanzo-svelte,
|
||||
fw = framework or _current_framework
|
||||
comps = components or []
|
||||
|
||||
lines = [f"/**", f" * {name}"]
|
||||
lines = ["/**", f" * {name}"]
|
||||
if description:
|
||||
lines.append(f" * {description}")
|
||||
lines.append(f" * Framework: {self._fw_name(fw)}")
|
||||
lines.append(f" * Components: {', '.join(comps)}")
|
||||
lines.append(f" */")
|
||||
lines.append(" */")
|
||||
lines.append("")
|
||||
|
||||
def pascal(s: str) -> str:
|
||||
@@ -341,13 +341,13 @@ Frameworks: hanzo (default), hanzo-native, hanzo-vue, hanzo-svelte,
|
||||
|
||||
lines.append("")
|
||||
lines.append(f"export function {name}() {{")
|
||||
lines.append(f" return (")
|
||||
lines.append(f' <div className="container mx-auto p-6">')
|
||||
lines.append(" return (")
|
||||
lines.append(' <div className="container mx-auto p-6">')
|
||||
for comp in comps:
|
||||
lines.append(f" <{pascal(comp)} />")
|
||||
lines.append(f" </div>")
|
||||
lines.append(f" )")
|
||||
lines.append(f"}}")
|
||||
lines.append(" </div>")
|
||||
lines.append(" )")
|
||||
lines.append("}")
|
||||
|
||||
code = "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
@@ -14,22 +14,22 @@ from hanzo_tools.core.base import (
|
||||
)
|
||||
from hanzo_tools.core.types import MCPResourceDocument
|
||||
from hanzo_tools.core.context import ToolContext, create_tool_context
|
||||
from hanzo_tools.core.decorators import auto_timeout
|
||||
from hanzo_tools.core.validation import ValidationResult, validate_path_parameter
|
||||
from hanzo_tools.core.permissions import PermissionManager
|
||||
from hanzo_tools.core.unified import (
|
||||
Range,
|
||||
Paging,
|
||||
BaseTool, # Unified HIP-0300 base class
|
||||
ActionHandler,
|
||||
ErrorCode,
|
||||
ToolError,
|
||||
ActionHandler,
|
||||
ConflictError,
|
||||
NotFoundError,
|
||||
InvalidParamsError,
|
||||
Paging,
|
||||
Range,
|
||||
content_hash,
|
||||
file_uri,
|
||||
content_hash,
|
||||
)
|
||||
from hanzo_tools.core.decorators import auto_timeout
|
||||
from hanzo_tools.core.validation import ValidationResult, validate_path_parameter
|
||||
from hanzo_tools.core.permissions import PermissionManager
|
||||
|
||||
__all__ = [
|
||||
# Base classes
|
||||
|
||||
Reference in New Issue
Block a user