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:
Yûki VACHOT 2025-11-29 02:27:58 +01:00
parent 126d04ab0f
commit bf5d1b890a
22 changed files with 160 additions and 145 deletions

View file

@ -1,32 +0,0 @@
"""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,
)