Spaces:
Running on T4
Running on T4
Download backend/app/common/schemas.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 897 Bytes
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/common/schemas.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/common/schemas.py
-
curl -L -o schemas.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/common/schemas.py
897 Bytes
| """Base request/response models and the list envelope.""" | |
| from datetime import datetime | |
| from typing import Generic, TypeVar | |
| from uuid import UUID | |
| from pydantic import BaseModel, ConfigDict | |
| T = TypeVar("T") | |
| class RequestModel(BaseModel): | |
| """Request bodies reject unknown fields and trim strings.""" | |
| model_config = ConfigDict(extra="forbid", str_strip_whitespace=True) | |
| class ResponseModel(BaseModel): | |
| model_config = ConfigDict(from_attributes=True) | |
| class Page(ResponseModel, Generic[T]): | |
| items: list[T] | |
| next_cursor: str | None = None | |
| class Items(ResponseModel, Generic[T]): | |
| """A complete (unpaginated) list.""" | |
| items: list[T] | |
| class MediaRef(ResponseModel): | |
| """A short-lived authorised read URL for stored media. Refetch the owning resource when it expires.""" | |
| upload_id: UUID | |
| url: str | |
| expires_at: datetime | |
| seconds: float | None = None | |