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
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.

View file

@ -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__)

View file

@ -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

View file

@ -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__)

View file

@ -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.

View file

@ -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)

View file

@ -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.

View file

@ -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:

View file

@ -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):

View file

@ -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):

View file

@ -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):

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 .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):