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