Refactor imports and standardize file naming: update module imports for consistency, align filenames with snake_case convention, and extract DynamicResponse to a dedicated module.
This commit is contained in:
parent
126d04ab0f
commit
bf5d1b890a
22 changed files with 160 additions and 145 deletions
32
src/geoguessr_mcp/models/daily_challenge.py
Normal file
32
src/geoguessr_mcp/models/daily_challenge.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"""DailyChallenge-related data models."""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class DailyChallenge:
|
||||
"""Daily challenge information."""
|
||||
|
||||
token: str
|
||||
map_name: str = ""
|
||||
date: str = ""
|
||||
time_limit: int = 0
|
||||
completed: bool = False
|
||||
score: Optional[int] = None
|
||||
raw_data: dict = field(default_factory=dict)
|
||||
|
||||
@classmethod
|
||||
def from_api_response(cls, data: dict) -> "DailyChallenge":
|
||||
"""Create DailyChallenge from API response."""
|
||||
return cls(
|
||||
token=data.get("token", data.get("challengeToken", "")),
|
||||
map_name=(
|
||||
data.get("map", {}).get("name", "") if isinstance(data.get("map"), dict) else ""
|
||||
),
|
||||
date=data.get("date", data.get("day", "")),
|
||||
time_limit=data.get("timeLimit", 0),
|
||||
completed=data.get("completed", data.get("played", False)),
|
||||
score=data.get("score"),
|
||||
raw_data=data,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue