From 6ad818ff517a6d5cb3af15403f014eced03ae8d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C3=BBki=20VACHOT?= Date: Mon, 1 Dec 2025 03:01:54 +0100 Subject: [PATCH] Fix ruff and black --- src/geoguessr_mcp/api/geoguessr_client.py | 24 +++++++++---------- src/geoguessr_mcp/auth/multi_user_session.py | 2 +- .../monitoring/endpoint/endpoint_monitor.py | 8 +++---- .../monitoring/schema/schema_registry.py | 2 +- .../services/analysis_service.py | 14 +++++------ src/geoguessr_mcp/services/game_service.py | 20 ++++++++-------- src/geoguessr_mcp/services/profile_service.py | 14 +++++------ src/geoguessr_mcp/tools/__init__.py | 10 ++++---- src/geoguessr_mcp/tools/analysis_tools.py | 2 +- src/geoguessr_mcp/tools/game_tools.py | 2 +- src/geoguessr_mcp/tools/monitoring_tools.py | 2 +- src/geoguessr_mcp/tools/profile_tools.py | 2 +- 12 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/geoguessr_mcp/api/geoguessr_client.py b/src/geoguessr_mcp/api/geoguessr_client.py index 23e4c44..c27f432 100644 --- a/src/geoguessr_mcp/api/geoguessr_client.py +++ b/src/geoguessr_mcp/api/geoguessr_client.py @@ -13,12 +13,12 @@ import logging import httpx -from .dynamic_response import DynamicResponse -from .endpoints import EndpointInfo from ..auth import get_current_user_context from ..auth.session import SessionManager from ..config import settings from ..monitoring.schema.schema_registry import schema_registry +from .dynamic_response import DynamicResponse +from .endpoints import EndpointInfo logger = logging.getLogger(__name__) @@ -44,7 +44,7 @@ class GeoGuessrClient: async def _get_authenticated_client( self, - session_token: str | None = None, + session_token: str | None = None, ) -> httpx.AsyncClient: """ Get an authenticated HTTP client. @@ -78,9 +78,9 @@ class GeoGuessrClient: async def request( self, endpoint: EndpointInfo, - session_token: str | None = None, - params: dict | None = None, - json_data: dict | None = None, + session_token: str | None = None, + params: dict | None = None, + json_data: dict | None = None, **kwargs, ) -> DynamicResponse: """ @@ -153,8 +153,8 @@ class GeoGuessrClient: async def get( self, endpoint: EndpointInfo, - session_token: str | None = None, - params: dict | None = None, + session_token: str | None = None, + params: dict | None = None, **kwargs, ) -> DynamicResponse: """Make a GET request.""" @@ -163,8 +163,8 @@ class GeoGuessrClient: async def post( self, endpoint: EndpointInfo, - session_token: str | None = None, - json_data: dict | None = None, + session_token: str | None = None, + json_data: dict | None = None, **kwargs, ) -> DynamicResponse: """Make a POST request.""" @@ -173,9 +173,9 @@ class GeoGuessrClient: async def get_raw( self, path: str, - session_token: str | None = None, + session_token: str | None = None, use_game_server: bool = False, - params: dict | None = None, + params: dict | None = None, ) -> DynamicResponse: """ Make a raw GET request to any path. diff --git a/src/geoguessr_mcp/auth/multi_user_session.py b/src/geoguessr_mcp/auth/multi_user_session.py index 11cd5a5..2d5f23a 100644 --- a/src/geoguessr_mcp/auth/multi_user_session.py +++ b/src/geoguessr_mcp/auth/multi_user_session.py @@ -8,9 +8,9 @@ where each API key can have its own GeoGuessr session. import asyncio import logging +from ..config import settings from .session import SessionManager, UserSession from .user_context import UserContext -from ..config import settings logger = logging.getLogger(__name__) diff --git a/src/geoguessr_mcp/monitoring/endpoint/endpoint_monitor.py b/src/geoguessr_mcp/monitoring/endpoint/endpoint_monitor.py index a98473c..cd7ab2c 100644 --- a/src/geoguessr_mcp/monitoring/endpoint/endpoint_monitor.py +++ b/src/geoguessr_mcp/monitoring/endpoint/endpoint_monitor.py @@ -18,10 +18,10 @@ from datetime import UTC, datetime import httpx +from ...config import settings +from ..schema.schema_registry import SchemaRegistry, schema_registry from .endpoint_definition import EndpointDefinition from .endpoint_monitoring_result import MonitoringResult -from ..schema.schema_registry import SchemaRegistry, schema_registry -from ...config import settings logger = logging.getLogger(__name__) @@ -119,8 +119,8 @@ class EndpointMonitor: def __init__( self, - registry: SchemaRegistry | None = None, - ncfa_cookie: str | None = None, + registry: SchemaRegistry | None = None, + ncfa_cookie: str | None = None, ): self.registry = registry or schema_registry self.ncfa_cookie = ncfa_cookie or settings.DEFAULT_NCFA_COOKIE diff --git a/src/geoguessr_mcp/monitoring/schema/schema_registry.py b/src/geoguessr_mcp/monitoring/schema/schema_registry.py index 0b0dfcd..12f82ea 100644 --- a/src/geoguessr_mcp/monitoring/schema/schema_registry.py +++ b/src/geoguessr_mcp/monitoring/schema/schema_registry.py @@ -17,9 +17,9 @@ from datetime import UTC, datetime from pathlib import Path from typing import Any +from ...config import settings from .endpoint_schema import EndpointSchema from .schema_detector import SchemaDetector -from ...config import settings logger = logging.getLogger(__name__) diff --git a/src/geoguessr_mcp/services/analysis_service.py b/src/geoguessr_mcp/services/analysis_service.py index 7b25307..f16217c 100644 --- a/src/geoguessr_mcp/services/analysis_service.py +++ b/src/geoguessr_mcp/services/analysis_service.py @@ -8,11 +8,11 @@ dynamic data handling and LLM-friendly output formatting. import logging from dataclasses import dataclass, field -from .game_service import GameService -from .profile_service import ProfileService from ..api import GeoGuessrClient from ..models import Game from ..monitoring import schema_registry +from .game_service import GameService +from .profile_service import ProfileService logger = logging.getLogger(__name__) @@ -60,8 +60,8 @@ class AnalysisService: def __init__( self, client: GeoGuessrClient, - game_service: GameService | None = None, - profile_service: ProfileService | None = None, + game_service: GameService | None = None, + profile_service: ProfileService | None = None, ): self.client = client self.game_service = game_service or GameService(client) @@ -154,7 +154,7 @@ class AnalysisService: async def analyze_recent_games( self, count: int = 10, - session_token: str | None = None, + session_token: str | None = None, ) -> dict: """ Analyze recent games and provide statistics summary. @@ -180,7 +180,7 @@ class AnalysisService: async def get_performance_summary( self, - session_token: str | None = None, + session_token: str | None = None, ) -> dict: """ Get a comprehensive performance summary. @@ -245,7 +245,7 @@ class AnalysisService: async def get_strategy_recommendations( self, - session_token: str | None = None, + session_token: str | None = None, ) -> dict: """ Generate strategy recommendations based on performance analysis. diff --git a/src/geoguessr_mcp/services/game_service.py b/src/geoguessr_mcp/services/game_service.py index 4bdcf2c..fca36da 100644 --- a/src/geoguessr_mcp/services/game_service.py +++ b/src/geoguessr_mcp/services/game_service.py @@ -21,7 +21,7 @@ class GameService: async def get_game_details( self, game_token: str, - session_token: str | None = None, + session_token: str | None = None, ) -> tuple[Game, DynamicResponse]: """ Get details for a specific game. @@ -44,7 +44,7 @@ class GameService: async def get_unfinished_games( self, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """Get list of unfinished games.""" return await self.client.get(Endpoints.GAMES.GET_UNFINISHED_GAMES, session_token) @@ -52,7 +52,7 @@ class GameService: async def get_streak_game( self, game_token: str, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """Get streak game details.""" endpoint = Endpoints.GAMES.get_streak_game(game_token) @@ -62,7 +62,7 @@ class GameService: self, count: int = 10, page: int = 0, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """ Get the activity feed. @@ -81,7 +81,7 @@ class GameService: async def get_recent_games( self, count: int = 10, - session_token: str | None = None, + session_token: str | None = None, ) -> list[Game]: """ Get recent games from the activity feed. @@ -121,7 +121,7 @@ class GameService: async def get_season_stats( self, - session_token: str | None = None, + session_token: str | None = None, ) -> tuple[SeasonStats, DynamicResponse]: """Get active season statistics.""" response = await self.client.get( @@ -137,7 +137,7 @@ class GameService: async def get_daily_challenge( self, day: str = "today", - session_token: str | None = None, + session_token: str | None = None, ) -> tuple[DailyChallenge, DynamicResponse]: """ Get daily challenge. @@ -161,7 +161,7 @@ class GameService: async def get_battle_royale( self, game_id: str, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """Get battle royale game details.""" endpoint = Endpoints.GAME_SERVER.get_battle_royale(game_id) @@ -170,7 +170,7 @@ class GameService: async def get_duel( self, duel_id: str, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """Get duel game details.""" endpoint = Endpoints.GAME_SERVER.get_duel(duel_id) @@ -178,7 +178,7 @@ class GameService: async def get_tournaments( self, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """Get tournament information.""" return await self.client.get(Endpoints.GAME_SERVER.GET_TOURNAMENTS, session_token) diff --git a/src/geoguessr_mcp/services/profile_service.py b/src/geoguessr_mcp/services/profile_service.py index 39cf4d2..9259e11 100644 --- a/src/geoguessr_mcp/services/profile_service.py +++ b/src/geoguessr_mcp/services/profile_service.py @@ -21,7 +21,7 @@ class ProfileService: async def get_profile( self, - session_token: str | None = None, + session_token: str | None = None, ) -> tuple[UserProfile, DynamicResponse]: """ Get current user's profile. @@ -39,7 +39,7 @@ class ProfileService: async def get_stats( self, - session_token: str | None = None, + session_token: str | None = None, ) -> tuple[UserStats, DynamicResponse]: """ Get user statistics. @@ -57,7 +57,7 @@ class ProfileService: async def get_extended_stats( self, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """ Get extended statistics. @@ -68,7 +68,7 @@ class ProfileService: async def get_achievements( self, - session_token: str | None = None, + session_token: str | None = None, ) -> tuple[list[Achievement], DynamicResponse]: """ Get user achievements. @@ -95,7 +95,7 @@ class ProfileService: async def get_public_profile( self, user_id: str, - session_token: str | None = None, + session_token: str | None = None, ) -> tuple[UserProfile, DynamicResponse]: """Get another user's public profile.""" endpoint = Endpoints.PROFILES.get_public_profile(user_id) @@ -109,14 +109,14 @@ class ProfileService: async def get_user_maps( self, - session_token: str | None = None, + session_token: str | None = None, ) -> DynamicResponse: """Get user's custom maps.""" return await self.client.get(Endpoints.PROFILES.GET_USER_MAPS, session_token) async def get_comprehensive_profile( self, - session_token: str | None = None, + session_token: str | None = None, ) -> dict: """ Get a comprehensive profile combining multiple endpoints. diff --git a/src/geoguessr_mcp/tools/__init__.py b/src/geoguessr_mcp/tools/__init__.py index e9e0917..6e2772a 100644 --- a/src/geoguessr_mcp/tools/__init__.py +++ b/src/geoguessr_mcp/tools/__init__.py @@ -2,17 +2,17 @@ from mcp.server.fastmcp import FastMCP -from .analysis_tools import register_analysis_tools -from .auth_tools import register_auth_tools -from .game_tools import register_game_tools -from .monitoring_tools import register_monitoring_tools -from .profile_tools import register_profile_tools from ..api.geoguessr_client import GeoGuessrClient from ..auth.session import SessionManager from ..config import settings from ..services.analysis_service import AnalysisService from ..services.game_service import GameService from ..services.profile_service import ProfileService +from .analysis_tools import register_analysis_tools +from .auth_tools import register_auth_tools +from .game_tools import register_game_tools +from .monitoring_tools import register_monitoring_tools +from .profile_tools import register_profile_tools def register_all_tools(mcp: FastMCP) -> dict: diff --git a/src/geoguessr_mcp/tools/analysis_tools.py b/src/geoguessr_mcp/tools/analysis_tools.py index 9482810..a9be60f 100644 --- a/src/geoguessr_mcp/tools/analysis_tools.py +++ b/src/geoguessr_mcp/tools/analysis_tools.py @@ -11,8 +11,8 @@ offers asynchronous execution for efficient performance. from mcp.server.fastmcp import FastMCP -from .auth_tools import get_current_session_token from ..services.analysis_service import AnalysisService +from .auth_tools import get_current_session_token def register_analysis_tools(mcp: FastMCP, analysis_service: AnalysisService): diff --git a/src/geoguessr_mcp/tools/game_tools.py b/src/geoguessr_mcp/tools/game_tools.py index d9cd345..fe10b72 100644 --- a/src/geoguessr_mcp/tools/game_tools.py +++ b/src/geoguessr_mcp/tools/game_tools.py @@ -13,8 +13,8 @@ Functions: from mcp.server.fastmcp import FastMCP -from .auth_tools import get_current_session_token from ..services.game_service import GameService +from .auth_tools import get_current_session_token def register_game_tools(mcp: FastMCP, game_service: GameService): diff --git a/src/geoguessr_mcp/tools/monitoring_tools.py b/src/geoguessr_mcp/tools/monitoring_tools.py index 9a28e10..6d6905d 100644 --- a/src/geoguessr_mcp/tools/monitoring_tools.py +++ b/src/geoguessr_mcp/tools/monitoring_tools.py @@ -10,8 +10,8 @@ evolution. from mcp.server.fastmcp import FastMCP -from .auth_tools import get_current_session_token from ..monitoring import endpoint_monitor, schema_registry +from .auth_tools import get_current_session_token def register_monitoring_tools(mcp: FastMCP): diff --git a/src/geoguessr_mcp/tools/profile_tools.py b/src/geoguessr_mcp/tools/profile_tools.py index 6337457..8358612 100644 --- a/src/geoguessr_mcp/tools/profile_tools.py +++ b/src/geoguessr_mcp/tools/profile_tools.py @@ -12,8 +12,8 @@ from the underlying service API. Tools return structured data for easy consumpti from mcp.server.fastmcp import FastMCP -from .auth_tools import get_current_session_token from ..services.profile_service import ProfileService +from .auth_tools import get_current_session_token def register_profile_tools(mcp: FastMCP, profile_service: ProfileService):