fix: apply isort formatting to fix CI linting

Applied isort to properly sort all imports according to PEP8:
- Standard library imports first
- Third-party imports second
- Local imports last
- Alphabetical ordering within each group

All tests still passing after import reordering.
This commit is contained in:
Fahad
2025-06-08 22:32:27 +04:00
parent 1aa19548d1
commit c03af1629f
18 changed files with 64 additions and 67 deletions

View File

@@ -4,8 +4,9 @@ This file exists to maintain compatibility with existing configurations.
The main implementation is now in server.py
"""
from server import main
import asyncio
from server import main
if __name__ == "__main__":
asyncio.run(main())

View File

@@ -2,12 +2,8 @@
System prompts for Gemini tools
"""
from .tool_prompts import (
THINK_DEEPER_PROMPT,
REVIEW_CODE_PROMPT,
DEBUG_ISSUE_PROMPT,
ANALYZE_PROMPT,
)
from .tool_prompts import (ANALYZE_PROMPT, DEBUG_ISSUE_PROMPT,
REVIEW_CODE_PROMPT, THINK_DEEPER_PROMPT)
__all__ = [
"THINK_DEEPER_PROMPT",

View File

@@ -2,27 +2,22 @@
Gemini MCP Server - Main server implementation
"""
import os
import sys
import asyncio
import logging
import os
import sys
from datetime import datetime
from typing import List, Dict, Any
from typing import Any, Dict, List
import google.generativeai as genai
from mcp.server import Server
from mcp.server.models import InitializationOptions
from mcp.server.stdio import stdio_server
from mcp.types import TextContent, Tool
from mcp.server.models import InitializationOptions
from config import (
__version__,
__updated__,
__author__,
DEFAULT_MODEL,
MAX_CONTEXT_TOKENS,
)
from tools import ThinkDeeperTool, ReviewCodeTool, DebugIssueTool, AnalyzeTool
from config import (DEFAULT_MODEL, MAX_CONTEXT_TOKENS, __author__, __updated__,
__version__)
from tools import AnalyzeTool, DebugIssueTool, ReviewCodeTool, ThinkDeeperTool
# Configure logging
logging.basicConfig(level=logging.INFO)
@@ -147,8 +142,8 @@ async def handle_call_tool(
async def handle_chat(arguments: Dict[str, Any]) -> List[TextContent]:
"""Handle general chat requests"""
from utils import read_files
from config import TEMPERATURE_BALANCED
from utils import read_files
prompt = arguments.get("prompt", "")
context_files = arguments.get("context_files", [])

View File

@@ -2,9 +2,10 @@
Setup configuration for Gemini MCP Server
"""
from setuptools import setup
from pathlib import Path
from setuptools import setup
# Read README for long description
readme_path = Path(__file__).parent / "README.md"
long_description = ""

View File

@@ -2,8 +2,8 @@
Pytest configuration for Gemini MCP Server tests
"""
import sys
import os
import sys
from pathlib import Path
# Ensure the parent directory is in the Python path for imports

View File

@@ -2,17 +2,9 @@
Tests for configuration
"""
from config import (
__version__,
__updated__,
__author__,
DEFAULT_MODEL,
MAX_CONTEXT_TOKENS,
TEMPERATURE_ANALYTICAL,
TEMPERATURE_BALANCED,
TEMPERATURE_CREATIVE,
TOOL_TRIGGERS,
)
from config import (DEFAULT_MODEL, MAX_CONTEXT_TOKENS, TEMPERATURE_ANALYTICAL,
TEMPERATURE_BALANCED, TEMPERATURE_CREATIVE, TOOL_TRIGGERS,
__author__, __updated__, __version__)
class TestConfig:

View File

@@ -2,11 +2,12 @@
Tests for the main server functionality
"""
import pytest
import json
from unittest.mock import Mock, patch
from server import handle_list_tools, handle_call_tool
import pytest
from server import handle_call_tool, handle_list_tools
class TestServerTools:

View File

@@ -2,10 +2,11 @@
Tests for individual tool implementations
"""
import pytest
from unittest.mock import Mock, patch
from tools import ThinkDeeperTool, ReviewCodeTool, DebugIssueTool, AnalyzeTool
import pytest
from tools import AnalyzeTool, DebugIssueTool, ReviewCodeTool, ThinkDeeperTool
class TestThinkDeeperTool:

View File

@@ -2,12 +2,8 @@
Tests for utility functions
"""
from utils import (
read_file_content,
read_files,
estimate_tokens,
check_token_limit,
)
from utils import (check_token_limit, estimate_tokens, read_file_content,
read_files)
class TestFileUtils:

View File

@@ -2,10 +2,10 @@
Tool implementations for Gemini MCP Server
"""
from .think_deeper import ThinkDeeperTool
from .review_code import ReviewCodeTool
from .debug_issue import DebugIssueTool
from .analyze import AnalyzeTool
from .debug_issue import DebugIssueTool
from .review_code import ReviewCodeTool
from .think_deeper import ThinkDeeperTool
__all__ = [
"ThinkDeeperTool",

View File

@@ -2,12 +2,15 @@
Analyze tool - General-purpose code and file analysis
"""
from typing import Dict, Any, List, Optional
from typing import Any, Dict, List, Optional
from pydantic import Field
from .base import BaseTool, ToolRequest
from config import MAX_CONTEXT_TOKENS, TEMPERATURE_ANALYTICAL
from prompts import ANALYZE_PROMPT
from utils import read_files, check_token_limit
from config import TEMPERATURE_ANALYTICAL, MAX_CONTEXT_TOKENS
from utils import check_token_limit, read_files
from .base import BaseTool, ToolRequest
class AnalyzeRequest(ToolRequest):

View File

@@ -3,10 +3,11 @@ Base class for all Gemini MCP tools
"""
from abc import ABC, abstractmethod
from typing import Dict, Any, List, Optional
from pydantic import BaseModel, Field
from typing import Any, Dict, List, Optional
import google.generativeai as genai
from mcp.types import TextContent
from pydantic import BaseModel, Field
class ToolRequest(BaseModel):

View File

@@ -2,12 +2,15 @@
Debug Issue tool - Root cause analysis and debugging assistance
"""
from typing import Dict, Any, List, Optional
from typing import Any, Dict, List, Optional
from pydantic import Field
from .base import BaseTool, ToolRequest
from config import MAX_CONTEXT_TOKENS, TEMPERATURE_ANALYTICAL
from prompts import DEBUG_ISSUE_PROMPT
from utils import read_files, check_token_limit
from config import TEMPERATURE_ANALYTICAL, MAX_CONTEXT_TOKENS
from utils import check_token_limit, read_files
from .base import BaseTool, ToolRequest
class DebugIssueRequest(ToolRequest):

View File

@@ -2,12 +2,15 @@
Code Review tool - Comprehensive code analysis and review
"""
from typing import Dict, Any, List, Optional
from typing import Any, Dict, List, Optional
from pydantic import Field
from .base import BaseTool, ToolRequest
from config import MAX_CONTEXT_TOKENS, TEMPERATURE_ANALYTICAL
from prompts import REVIEW_CODE_PROMPT
from utils import read_files, check_token_limit
from config import TEMPERATURE_ANALYTICAL, MAX_CONTEXT_TOKENS
from utils import check_token_limit, read_files
from .base import BaseTool, ToolRequest
class ReviewCodeRequest(ToolRequest):

View File

@@ -2,12 +2,15 @@
Think Deeper tool - Extended reasoning and problem-solving
"""
from typing import Dict, Any, List, Optional
from typing import Any, Dict, List, Optional
from pydantic import Field
from .base import BaseTool, ToolRequest
from config import MAX_CONTEXT_TOKENS, TEMPERATURE_CREATIVE
from prompts import THINK_DEEPER_PROMPT
from utils import read_files, check_token_limit
from config import TEMPERATURE_CREATIVE, MAX_CONTEXT_TOKENS
from utils import check_token_limit, read_files
from .base import BaseTool, ToolRequest
class ThinkDeeperRequest(ToolRequest):

View File

@@ -2,8 +2,8 @@
Utility functions for Gemini MCP Server
"""
from .file_utils import read_files, read_file_content
from .token_utils import estimate_tokens, check_token_limit
from .file_utils import read_file_content, read_files
from .token_utils import check_token_limit, estimate_tokens
__all__ = [
"read_files",

View File

@@ -3,7 +3,7 @@ File reading utilities
"""
from pathlib import Path
from typing import List, Tuple, Optional
from typing import List, Optional, Tuple
def read_file_content(file_path: str) -> str:

View File

@@ -3,6 +3,7 @@ Token counting utilities
"""
from typing import Tuple
from config import MAX_CONTEXT_TOKENS