mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
fix(lint): fix import sorting and lru_cache noqa
- Fix 12 import sorting issues (I001) - Add noqa for lru_cache in shellflow.py (TID251 rule for Stainless SDK)
This commit is contained in:
@@ -5,8 +5,8 @@ Two-phase finality for multi-agent agreement.
|
||||
Reference: https://github.com/luxfi/consensus
|
||||
"""
|
||||
|
||||
from .consensus import Consensus, State, Result, run
|
||||
from .mcp_mesh import MCPMesh, MCPAgent, run_mcp_consensus, create_mesh
|
||||
from .mcp_mesh import MCPMesh, MCPAgent, create_mesh, run_mcp_consensus
|
||||
from .consensus import State, Result, Consensus, run
|
||||
|
||||
__all__ = [
|
||||
# Core
|
||||
|
||||
@@ -17,8 +17,8 @@ Reference: https://github.com/luxfi/consensus
|
||||
|
||||
import random
|
||||
import asyncio
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Callable, Coroutine, Dict, List, Optional, TypeVar
|
||||
from typing import Any, Dict, List, TypeVar, Callable, Optional, Coroutine
|
||||
from dataclasses import field, dataclass
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ Usage:
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Callable, Coroutine, Dict, List, Optional
|
||||
from typing import Any, Dict, List, Callable, Optional, Coroutine
|
||||
from dataclasses import field, dataclass
|
||||
|
||||
from .consensus import Result, State, run
|
||||
from .consensus import State, Result, run
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -23,16 +23,16 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Core tools
|
||||
from .agent_tool import AgentTool
|
||||
from .iching_tool import IChingTool
|
||||
from .review_tool import ReviewTool
|
||||
|
||||
# Legacy imports for backwards compatibility
|
||||
from .critic_tool import CriticTool # Legacy - use reasoning.critic instead
|
||||
from .iching_tool import IChingTool
|
||||
from .review_tool import ReviewTool
|
||||
from .grok_cli_tool import GrokCLITool
|
||||
from .cli_agent_base import CLIAgentBase
|
||||
from .codex_cli_tool import CodexCLITool
|
||||
from .claude_cli_tool import ClaudeCLITool
|
||||
from .gemini_cli_tool import GeminiCLITool
|
||||
from .grok_cli_tool import GrokCLITool
|
||||
|
||||
# Export list for tool discovery
|
||||
TOOLS = [
|
||||
|
||||
@@ -13,12 +13,12 @@ Consensus: https://github.com/luxfi/consensus
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
import asyncio
|
||||
import signal
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass, field
|
||||
import asyncio
|
||||
from typing import Any, Dict, List, Literal, Optional, Annotated, final, override
|
||||
from pathlib import Path
|
||||
from contextlib import suppress
|
||||
from dataclasses import field, dataclass
|
||||
|
||||
import aiofiles
|
||||
from pydantic import Field
|
||||
@@ -45,9 +45,7 @@ except ImportError:
|
||||
|
||||
# Optional consensus import - fallback to local implementation
|
||||
try:
|
||||
from hanzo_consensus import Consensus as MetastableConsensus
|
||||
from hanzo_consensus import Result as ConsensusResult
|
||||
from hanzo_consensus import run as run_consensus
|
||||
from hanzo_consensus import Result as ConsensusResult, Consensus as MetastableConsensus, run as run_consensus
|
||||
HAS_CONSENSUS = True
|
||||
except ImportError:
|
||||
HAS_CONSENSUS = False
|
||||
|
||||
Generated
+1881
File diff suppressed because it is too large
Load Diff
@@ -14,13 +14,13 @@ warnings.warn(
|
||||
# Re-export everything from hanzo-tools
|
||||
from hanzo_tools.core.base import (
|
||||
BaseTool,
|
||||
FileSystemTool,
|
||||
ToolRegistry,
|
||||
FileSystemTool,
|
||||
)
|
||||
from hanzo_tools.core.permissions import PermissionManager
|
||||
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.types import MCPResourceDocument
|
||||
from hanzo_tools.core.permissions import PermissionManager
|
||||
|
||||
__all__ = [
|
||||
"BaseTool",
|
||||
|
||||
Generated
+1478
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,10 @@ import asyncio
|
||||
from typing import List, Optional, Annotated, final, override
|
||||
|
||||
from pydantic import Field
|
||||
from hanzo_consensus import Result as ConsensusResult, run as run_consensus
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
from hanzo_tools.core import BaseTool, auto_timeout, create_tool_context
|
||||
from hanzo_consensus import run as run_consensus, Result as ConsensusResult
|
||||
|
||||
from .llm_unified import LLMTool
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
from setuptools import setup
|
||||
from mypyc.build import mypycify
|
||||
|
||||
setup(
|
||||
name='mypyc_output',
|
||||
ext_modules=mypycify(
|
||||
['hanzo_tools/shell/shellflow.py'],
|
||||
opt_level="3",
|
||||
debug_level="1",
|
||||
strict_dunder_typing=False,
|
||||
log_trace=False,
|
||||
),
|
||||
)
|
||||
@@ -32,6 +32,7 @@ Use 'zsh/shell' for:
|
||||
from mcp.server import FastMCP
|
||||
|
||||
from hanzo_tools.core import BaseTool, ToolRegistry, PermissionManager
|
||||
from hanzo_tools.shell.jq_tool import JqTool
|
||||
from hanzo_tools.shell.ps_tool import PsTool, ps_tool
|
||||
|
||||
# Core tools
|
||||
@@ -39,15 +40,14 @@ from hanzo_tools.shell.dag_tool import DagTool, create_dag_tool
|
||||
from hanzo_tools.shell.npx_tool import NpxTool, npx_tool
|
||||
from hanzo_tools.shell.truncate import truncate_lines, estimate_tokens, truncate_response
|
||||
from hanzo_tools.shell.uvx_tool import UvxTool, uvx_tool
|
||||
from hanzo_tools.shell.zsh_tool import ZshTool, ShellTool, BashTool, zsh_tool, shell_tool, bash_tool
|
||||
from hanzo_tools.shell.shellflow import parse as parse_shellflow, compile as compile_shellflow
|
||||
|
||||
# Convenience tools
|
||||
from hanzo_tools.shell.open_tool import OpenTool, open_tool
|
||||
from hanzo_tools.shell.zsh_tool import ZshTool, BashTool, ShellTool, zsh_tool, bash_tool, shell_tool
|
||||
|
||||
# HTTP/Data tools (no shell escaping issues)
|
||||
from hanzo_tools.shell.curl_tool import CurlTool
|
||||
from hanzo_tools.shell.jq_tool import JqTool
|
||||
|
||||
# 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
|
||||
from hanzo_tools.shell.wget_tool import WgetTool
|
||||
|
||||
# Base classes
|
||||
|
||||
@@ -26,8 +26,8 @@ Performance:
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from functools import lru_cache
|
||||
from typing import Any, Dict, List, Tuple, Union, Final
|
||||
from typing import Any, Dict, List, Final, Tuple, Union
|
||||
from functools import lru_cache # noqa: TID251 - not using Stainless SDK
|
||||
|
||||
# Type aliases with full annotations
|
||||
ASTDict = Dict[str, Any]
|
||||
|
||||
@@ -31,8 +31,8 @@ from mcp.server import FastMCP
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
from hanzo_tools.core import BaseTool, auto_timeout, create_tool_context
|
||||
from hanzo_tools.shell.base_process import ProcessManager
|
||||
from hanzo_tools.shell.shellflow import parse as parse_shellflow, to_commands as shellflow_to_commands
|
||||
from hanzo_tools.shell.base_process import ProcessManager
|
||||
|
||||
|
||||
class NodeStatus(Enum):
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
"""Comprehensive tests for Shellflow DSL parser and execution."""
|
||||
|
||||
import pytest
|
||||
import asyncio
|
||||
import time
|
||||
import asyncio
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from hanzo_tools.shell.shellflow import (
|
||||
parse,
|
||||
to_sexp,
|
||||
from_sexp,
|
||||
to_commands,
|
||||
compile,
|
||||
render_ascii,
|
||||
to_sexp,
|
||||
_tokenize,
|
||||
from_sexp,
|
||||
_normalize,
|
||||
to_commands,
|
||||
render_ascii,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Generated
+1622
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user