mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
fix: resolve all ruff lint errors (F401, F841, E741, I001)
Remove unused imports, fix unsorted import blocks, rename ambiguous variable, and remove unused local variable assignment.
This commit is contained in:
@@ -17,7 +17,7 @@ import json
|
||||
import logging
|
||||
import struct
|
||||
import time
|
||||
from typing import Any, Callable, Awaitable
|
||||
from typing import Any, Awaitable, Callable
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -18,13 +18,11 @@ Scope: File → Package → Repo
|
||||
"""
|
||||
|
||||
import difflib
|
||||
import json
|
||||
import os
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any, ClassVar, Literal
|
||||
|
||||
from mcp.server import FastMCP
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
from hanzo_tools.core import (
|
||||
@@ -720,7 +718,7 @@ All operations are PURE - safe to cache and parallelize.
|
||||
if not full_path.exists():
|
||||
raise NotFoundError(f"File not found: {path}")
|
||||
text = full_path.read_text()
|
||||
export_lines = [l.strip() for l in text.splitlines() if l.strip().startswith(("export ", "pub ", "__all__"))]
|
||||
export_lines = [line.strip() for line in text.splitlines() if line.strip().startswith(("export ", "pub ", "__all__"))]
|
||||
return {"uri": str(full_path), "exports": export_lines, "count": len(export_lines)}
|
||||
|
||||
@self.action("types", "Find type definitions in file")
|
||||
|
||||
@@ -573,6 +573,7 @@ Examples:
|
||||
async def _export(self, scope: str, limit: int) -> str:
|
||||
"""Export memories as JSON."""
|
||||
import json as json_mod
|
||||
|
||||
from hanzo_tools.memory.markdown_memory import get_markdown_backend
|
||||
backend = get_markdown_backend()
|
||||
backend._ensure_loaded()
|
||||
|
||||
@@ -11,14 +11,12 @@ Network operations are inherently non-deterministic.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any, ClassVar
|
||||
from typing import ClassVar
|
||||
from urllib.parse import urljoin, urlparse
|
||||
|
||||
from mcp.server import FastMCP
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
from hanzo_tools.core import (
|
||||
@@ -523,7 +521,6 @@ Effect: NONDETERMINISTIC_EFFECT (network I/O)
|
||||
Effect: NONDETERMINISTIC_EFFECT
|
||||
"""
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
system = platform.system().lower()
|
||||
if system == "darwin":
|
||||
|
||||
@@ -14,14 +14,12 @@ Effect lattice:
|
||||
- execute: NONDETERMINISTIC (audit-friendly)
|
||||
"""
|
||||
|
||||
import json
|
||||
import re
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
from enum import Enum
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from mcp.server import FastMCP
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
from hanzo_tools.core import (
|
||||
|
||||
@@ -14,11 +14,9 @@ Outputs diffs in unified patch format; integrates with fs.apply_patch.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
from typing import Any, ClassVar
|
||||
from typing import ClassVar
|
||||
|
||||
from mcp.server import FastMCP
|
||||
from mcp.server.fastmcp import Context as MCPContext
|
||||
|
||||
from hanzo_tools.core import (
|
||||
@@ -570,7 +568,6 @@ Outputs diffs in unified patch format for use with fs.apply_patch.
|
||||
|
||||
@self.action("init", "Initialize repository")
|
||||
async def init(ctx: MCPContext, path: str | None = None, bare: bool = False, cwd: str | None = None) -> dict:
|
||||
work_dir = path or cwd or self.cwd
|
||||
args = ["init"]
|
||||
if bare:
|
||||
args.append("--bare")
|
||||
|
||||
@@ -396,8 +396,8 @@ class BaseTool(_BaseToolABC):
|
||||
from pydantic import ConfigDict
|
||||
from mcp.server.fastmcp.tools.base import Tool as FastMCPTool
|
||||
from mcp.server.fastmcp.utilities.func_metadata import (
|
||||
FuncMetadata,
|
||||
ArgModelBase,
|
||||
FuncMetadata,
|
||||
)
|
||||
|
||||
tool_name = self.name
|
||||
|
||||
@@ -12,16 +12,16 @@ Usage:
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import statistics
|
||||
import sys
|
||||
import tempfile
|
||||
import json
|
||||
import time
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
import asyncio
|
||||
import tempfile
|
||||
import statistics
|
||||
from typing import Any
|
||||
from pathlib import Path
|
||||
from dataclasses import field, dataclass
|
||||
|
||||
HANZO_ROOT = Path(os.environ.get("HANZO_ROOT", Path.home() / "work" / "hanzo"))
|
||||
TIMEOUT = 30
|
||||
|
||||
@@ -25,17 +25,17 @@ Usage:
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import json
|
||||
import time
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import asyncio
|
||||
import tempfile
|
||||
from typing import Any
|
||||
from pathlib import Path
|
||||
from dataclasses import field, dataclass
|
||||
|
||||
# ── Configuration ─────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user