Source code for dc4client.receive_data

from pydantic import BaseModel, ConfigDict, Json
from typing import Optional, Dict, List
from uuid import UUID
from datetime import datetime


[docs] class TournamentSchema(BaseModel): tournament_id: UUID tournament_name: str model_config = ConfigDict(from_attributes=True)
[docs] class PhysicalSimulatorSchema(BaseModel): physical_simulator_id: UUID simulator_name: str model_config = ConfigDict(from_attributes=True)
[docs] class PlayerSchema(BaseModel): player_id: UUID max_velocity: float shot_dispersion_rate: float player_name: str
[docs] class TrajectorySchema(BaseModel): trajectory_id: UUID trajectory_data: Json
[docs] class CoordinateDataSchema(BaseModel): x: float y: float model_config = ConfigDict(from_attributes=True)
[docs] class StoneCoordinateSchema(BaseModel): data: Dict[str, List[CoordinateDataSchema]] model_config = ConfigDict(from_attributes=True)
[docs] class ScoreSchema(BaseModel): team0: list team1: list model_config = ConfigDict(from_attributes=True)
[docs] class ShotInfoSchema(BaseModel): translational_velocity: float angular_velocity: float shot_angle: float
[docs] class PowerPlayEndSchema(BaseModel): team0: int | None = None team1: int | None = None
[docs] class MixedDoublesSettingsSchema(BaseModel): end_setup_team: str positioned_stones_pattern: int power_play_end: PowerPlayEndSchema
[docs] class StateSchema(BaseModel): winner_team: str | None end_number: int team_shot_number: int | None total_shot_number: int | None next_shot_team: str | None first_team_remaining_time: float second_team_remaining_time: float first_team_extra_end_remaining_time: float second_team_extra_end_remaining_time: float mixed_doubles_settings: Optional[MixedDoublesSettingsSchema] = None last_move: ShotInfoSchema | None stone_coordinate: Optional[StoneCoordinateSchema] = None score: Optional[ScoreSchema] = None model_config = ConfigDict(from_attributes=True)
[docs] class MatchDataSchema(BaseModel): match_id: UUID first_team_id: UUID second_team_id: UUID score_id: UUID time_limit: int extra_end_time_limit: int standard_end_count: int physical_simulator_id: UUID tournament_id: UUID match_name: str created_at: datetime started_at: datetime score: Optional[ScoreSchema] = None tournament: Optional[TournamentSchema] = None simulator: Optional[PhysicalSimulatorSchema] = None model_config = ConfigDict(from_attributes=True)