Fix ruff and black

This commit is contained in:
Yûki VACHOT 2025-12-01 03:01:54 +01:00
parent b0414cf6d0
commit 6ad818ff51
12 changed files with 51 additions and 51 deletions

View file

@ -13,12 +13,12 @@ import logging
import httpx import httpx
from .dynamic_response import DynamicResponse
from .endpoints import EndpointInfo
from ..auth import get_current_user_context from ..auth import get_current_user_context
from ..auth.session import SessionManager from ..auth.session import SessionManager
from ..config import settings from ..config import settings
from ..monitoring.schema.schema_registry import schema_registry from ..monitoring.schema.schema_registry import schema_registry
from .dynamic_response import DynamicResponse
from .endpoints import EndpointInfo
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -44,7 +44,7 @@ class GeoGuessrClient:
async def _get_authenticated_client( async def _get_authenticated_client(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> httpx.AsyncClient: ) -> httpx.AsyncClient:
""" """
Get an authenticated HTTP client. Get an authenticated HTTP client.
@ -78,9 +78,9 @@ class GeoGuessrClient:
async def request( async def request(
self, self,
endpoint: EndpointInfo, endpoint: EndpointInfo,
session_token: str | None = None, session_token: str | None = None,
params: dict | None = None, params: dict | None = None,
json_data: dict | None = None, json_data: dict | None = None,
**kwargs, **kwargs,
) -> DynamicResponse: ) -> DynamicResponse:
""" """
@ -153,8 +153,8 @@ class GeoGuessrClient:
async def get( async def get(
self, self,
endpoint: EndpointInfo, endpoint: EndpointInfo,
session_token: str | None = None, session_token: str | None = None,
params: dict | None = None, params: dict | None = None,
**kwargs, **kwargs,
) -> DynamicResponse: ) -> DynamicResponse:
"""Make a GET request.""" """Make a GET request."""
@ -163,8 +163,8 @@ class GeoGuessrClient:
async def post( async def post(
self, self,
endpoint: EndpointInfo, endpoint: EndpointInfo,
session_token: str | None = None, session_token: str | None = None,
json_data: dict | None = None, json_data: dict | None = None,
**kwargs, **kwargs,
) -> DynamicResponse: ) -> DynamicResponse:
"""Make a POST request.""" """Make a POST request."""
@ -173,9 +173,9 @@ class GeoGuessrClient:
async def get_raw( async def get_raw(
self, self,
path: str, path: str,
session_token: str | None = None, session_token: str | None = None,
use_game_server: bool = False, use_game_server: bool = False,
params: dict | None = None, params: dict | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
""" """
Make a raw GET request to any path. Make a raw GET request to any path.

View file

@ -8,9 +8,9 @@ where each API key can have its own GeoGuessr session.
import asyncio import asyncio
import logging import logging
from ..config import settings
from .session import SessionManager, UserSession from .session import SessionManager, UserSession
from .user_context import UserContext from .user_context import UserContext
from ..config import settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -18,10 +18,10 @@ from datetime import UTC, datetime
import httpx import httpx
from ...config import settings
from ..schema.schema_registry import SchemaRegistry, schema_registry
from .endpoint_definition import EndpointDefinition from .endpoint_definition import EndpointDefinition
from .endpoint_monitoring_result import MonitoringResult from .endpoint_monitoring_result import MonitoringResult
from ..schema.schema_registry import SchemaRegistry, schema_registry
from ...config import settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -119,8 +119,8 @@ class EndpointMonitor:
def __init__( def __init__(
self, self,
registry: SchemaRegistry | None = None, registry: SchemaRegistry | None = None,
ncfa_cookie: str | None = None, ncfa_cookie: str | None = None,
): ):
self.registry = registry or schema_registry self.registry = registry or schema_registry
self.ncfa_cookie = ncfa_cookie or settings.DEFAULT_NCFA_COOKIE self.ncfa_cookie = ncfa_cookie or settings.DEFAULT_NCFA_COOKIE

View file

@ -17,9 +17,9 @@ from datetime import UTC, datetime
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
from ...config import settings
from .endpoint_schema import EndpointSchema from .endpoint_schema import EndpointSchema
from .schema_detector import SchemaDetector from .schema_detector import SchemaDetector
from ...config import settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -8,11 +8,11 @@ dynamic data handling and LLM-friendly output formatting.
import logging import logging
from dataclasses import dataclass, field from dataclasses import dataclass, field
from .game_service import GameService
from .profile_service import ProfileService
from ..api import GeoGuessrClient from ..api import GeoGuessrClient
from ..models import Game from ..models import Game
from ..monitoring import schema_registry from ..monitoring import schema_registry
from .game_service import GameService
from .profile_service import ProfileService
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -60,8 +60,8 @@ class AnalysisService:
def __init__( def __init__(
self, self,
client: GeoGuessrClient, client: GeoGuessrClient,
game_service: GameService | None = None, game_service: GameService | None = None,
profile_service: ProfileService | None = None, profile_service: ProfileService | None = None,
): ):
self.client = client self.client = client
self.game_service = game_service or GameService(client) self.game_service = game_service or GameService(client)
@ -154,7 +154,7 @@ class AnalysisService:
async def analyze_recent_games( async def analyze_recent_games(
self, self,
count: int = 10, count: int = 10,
session_token: str | None = None, session_token: str | None = None,
) -> dict: ) -> dict:
""" """
Analyze recent games and provide statistics summary. Analyze recent games and provide statistics summary.
@ -180,7 +180,7 @@ class AnalysisService:
async def get_performance_summary( async def get_performance_summary(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> dict: ) -> dict:
""" """
Get a comprehensive performance summary. Get a comprehensive performance summary.
@ -245,7 +245,7 @@ class AnalysisService:
async def get_strategy_recommendations( async def get_strategy_recommendations(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> dict: ) -> dict:
""" """
Generate strategy recommendations based on performance analysis. Generate strategy recommendations based on performance analysis.

View file

@ -21,7 +21,7 @@ class GameService:
async def get_game_details( async def get_game_details(
self, self,
game_token: str, game_token: str,
session_token: str | None = None, session_token: str | None = None,
) -> tuple[Game, DynamicResponse]: ) -> tuple[Game, DynamicResponse]:
""" """
Get details for a specific game. Get details for a specific game.
@ -44,7 +44,7 @@ class GameService:
async def get_unfinished_games( async def get_unfinished_games(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
"""Get list of unfinished games.""" """Get list of unfinished games."""
return await self.client.get(Endpoints.GAMES.GET_UNFINISHED_GAMES, session_token) return await self.client.get(Endpoints.GAMES.GET_UNFINISHED_GAMES, session_token)
@ -52,7 +52,7 @@ class GameService:
async def get_streak_game( async def get_streak_game(
self, self,
game_token: str, game_token: str,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
"""Get streak game details.""" """Get streak game details."""
endpoint = Endpoints.GAMES.get_streak_game(game_token) endpoint = Endpoints.GAMES.get_streak_game(game_token)
@ -62,7 +62,7 @@ class GameService:
self, self,
count: int = 10, count: int = 10,
page: int = 0, page: int = 0,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
""" """
Get the activity feed. Get the activity feed.
@ -81,7 +81,7 @@ class GameService:
async def get_recent_games( async def get_recent_games(
self, self,
count: int = 10, count: int = 10,
session_token: str | None = None, session_token: str | None = None,
) -> list[Game]: ) -> list[Game]:
""" """
Get recent games from the activity feed. Get recent games from the activity feed.
@ -121,7 +121,7 @@ class GameService:
async def get_season_stats( async def get_season_stats(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> tuple[SeasonStats, DynamicResponse]: ) -> tuple[SeasonStats, DynamicResponse]:
"""Get active season statistics.""" """Get active season statistics."""
response = await self.client.get( response = await self.client.get(
@ -137,7 +137,7 @@ class GameService:
async def get_daily_challenge( async def get_daily_challenge(
self, self,
day: str = "today", day: str = "today",
session_token: str | None = None, session_token: str | None = None,
) -> tuple[DailyChallenge, DynamicResponse]: ) -> tuple[DailyChallenge, DynamicResponse]:
""" """
Get daily challenge. Get daily challenge.
@ -161,7 +161,7 @@ class GameService:
async def get_battle_royale( async def get_battle_royale(
self, self,
game_id: str, game_id: str,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
"""Get battle royale game details.""" """Get battle royale game details."""
endpoint = Endpoints.GAME_SERVER.get_battle_royale(game_id) endpoint = Endpoints.GAME_SERVER.get_battle_royale(game_id)
@ -170,7 +170,7 @@ class GameService:
async def get_duel( async def get_duel(
self, self,
duel_id: str, duel_id: str,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
"""Get duel game details.""" """Get duel game details."""
endpoint = Endpoints.GAME_SERVER.get_duel(duel_id) endpoint = Endpoints.GAME_SERVER.get_duel(duel_id)
@ -178,7 +178,7 @@ class GameService:
async def get_tournaments( async def get_tournaments(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
"""Get tournament information.""" """Get tournament information."""
return await self.client.get(Endpoints.GAME_SERVER.GET_TOURNAMENTS, session_token) return await self.client.get(Endpoints.GAME_SERVER.GET_TOURNAMENTS, session_token)

View file

@ -21,7 +21,7 @@ class ProfileService:
async def get_profile( async def get_profile(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> tuple[UserProfile, DynamicResponse]: ) -> tuple[UserProfile, DynamicResponse]:
""" """
Get current user's profile. Get current user's profile.
@ -39,7 +39,7 @@ class ProfileService:
async def get_stats( async def get_stats(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> tuple[UserStats, DynamicResponse]: ) -> tuple[UserStats, DynamicResponse]:
""" """
Get user statistics. Get user statistics.
@ -57,7 +57,7 @@ class ProfileService:
async def get_extended_stats( async def get_extended_stats(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
""" """
Get extended statistics. Get extended statistics.
@ -68,7 +68,7 @@ class ProfileService:
async def get_achievements( async def get_achievements(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> tuple[list[Achievement], DynamicResponse]: ) -> tuple[list[Achievement], DynamicResponse]:
""" """
Get user achievements. Get user achievements.
@ -95,7 +95,7 @@ class ProfileService:
async def get_public_profile( async def get_public_profile(
self, self,
user_id: str, user_id: str,
session_token: str | None = None, session_token: str | None = None,
) -> tuple[UserProfile, DynamicResponse]: ) -> tuple[UserProfile, DynamicResponse]:
"""Get another user's public profile.""" """Get another user's public profile."""
endpoint = Endpoints.PROFILES.get_public_profile(user_id) endpoint = Endpoints.PROFILES.get_public_profile(user_id)
@ -109,14 +109,14 @@ class ProfileService:
async def get_user_maps( async def get_user_maps(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> DynamicResponse: ) -> DynamicResponse:
"""Get user's custom maps.""" """Get user's custom maps."""
return await self.client.get(Endpoints.PROFILES.GET_USER_MAPS, session_token) return await self.client.get(Endpoints.PROFILES.GET_USER_MAPS, session_token)
async def get_comprehensive_profile( async def get_comprehensive_profile(
self, self,
session_token: str | None = None, session_token: str | None = None,
) -> dict: ) -> dict:
""" """
Get a comprehensive profile combining multiple endpoints. Get a comprehensive profile combining multiple endpoints.

View file

@ -2,17 +2,17 @@
from mcp.server.fastmcp import FastMCP 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 ..api.geoguessr_client import GeoGuessrClient
from ..auth.session import SessionManager from ..auth.session import SessionManager
from ..config import settings from ..config import settings
from ..services.analysis_service import AnalysisService from ..services.analysis_service import AnalysisService
from ..services.game_service import GameService from ..services.game_service import GameService
from ..services.profile_service import ProfileService 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: def register_all_tools(mcp: FastMCP) -> dict:

View file

@ -11,8 +11,8 @@ offers asynchronous execution for efficient performance.
from mcp.server.fastmcp import FastMCP from mcp.server.fastmcp import FastMCP
from .auth_tools import get_current_session_token
from ..services.analysis_service import AnalysisService from ..services.analysis_service import AnalysisService
from .auth_tools import get_current_session_token
def register_analysis_tools(mcp: FastMCP, analysis_service: AnalysisService): def register_analysis_tools(mcp: FastMCP, analysis_service: AnalysisService):

View file

@ -13,8 +13,8 @@ Functions:
from mcp.server.fastmcp import FastMCP from mcp.server.fastmcp import FastMCP
from .auth_tools import get_current_session_token
from ..services.game_service import GameService from ..services.game_service import GameService
from .auth_tools import get_current_session_token
def register_game_tools(mcp: FastMCP, game_service: GameService): def register_game_tools(mcp: FastMCP, game_service: GameService):

View file

@ -10,8 +10,8 @@ evolution.
from mcp.server.fastmcp import FastMCP from mcp.server.fastmcp import FastMCP
from .auth_tools import get_current_session_token
from ..monitoring import endpoint_monitor, schema_registry from ..monitoring import endpoint_monitor, schema_registry
from .auth_tools import get_current_session_token
def register_monitoring_tools(mcp: FastMCP): def register_monitoring_tools(mcp: FastMCP):

View file

@ -12,8 +12,8 @@ from the underlying service API. Tools return structured data for easy consumpti
from mcp.server.fastmcp import FastMCP from mcp.server.fastmcp import FastMCP
from .auth_tools import get_current_session_token
from ..services.profile_service import ProfileService from ..services.profile_service import ProfileService
from .auth_tools import get_current_session_token
def register_profile_tools(mcp: FastMCP, profile_service: ProfileService): def register_profile_tools(mcp: FastMCP, profile_service: ProfileService):