Spaces:
Running on T4
Running on T4
Download backend/app/modules/goals/schemas.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/goals/schemas.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/modules/goals/schemas.py
-
curl -L -o schemas.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/goals/schemas.py
1.84 kB
| from datetime import datetime | |
| from math import isfinite | |
| from typing import Annotated, Literal | |
| from uuid import UUID | |
| from pydantic import Field, StrictFloat, StrictInt, field_validator | |
| from app.common.schemas import RequestModel, ResponseModel | |
| Mode = Literal["h", "p"] | |
| Due = Literal["1 week", "2 weeks", "End of month"] | |
| class WeeklyIn(RequestModel): | |
| practice_days: Annotated[int, Field(strict=True, ge=1, le=7)] | |
| drill_sets: Annotated[int, Field(strict=True, ge=1, le=30)] | |
| class GoalIn(RequestModel): | |
| type: Literal["groups", "param", "score"] | |
| target: StrictInt | StrictFloat | |
| metric_id: str | None = Field(None, max_length=64) | |
| due: Due | |
| weekly: WeeklyIn | |
| note: str = Field("", max_length=160) | |
| expected_version: int | None = Field(None, ge=0) | |
| def _finite(cls, value: int | float) -> int | float: | |
| if not isfinite(value): | |
| raise ValueError("Must be a finite number.") | |
| return value | |
| class WeeklyOut(ResponseModel): | |
| practice_days: int | |
| drill_sets: int | |
| class GoalOut(ResponseModel): | |
| id: UUID | |
| player_id: UUID | |
| mode: str | |
| type: str | |
| target: int | float | |
| metric_id: str | None | |
| metric_name: str | None | |
| due: str | |
| due_at: datetime | |
| set_at: datetime | |
| set_by: str | None | |
| set_by_id: UUID | None | |
| note: str | |
| weekly: WeeklyOut | |
| version: int | |
| class GoalEnvelope(ResponseModel): | |
| goal: GoalOut | None | |
| class GoalHistoryOut(ResponseModel): | |
| id: UUID | |
| text: str | |
| range: str | |
| met: bool | None | |
| outcome: str | None | |
| start_at: datetime | |
| end_at: datetime | None | |
| evaluated_session_id: UUID | None | |
| class MilestoneOut(ResponseModel): | |
| id: UUID | |
| icon: str | |
| tone: str | |
| title: str | |
| when: str | |
| occurred_at: datetime | |
| source_goal_id: UUID | |