Spaces:
Running on Zero
Running on Zero
Download codestar/server/models.py from dongyanggg/codestar-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/spaces/dongyanggg/codestar-backend/resolve/main/codestar/server/models.py
- Command line
-
hf download hf://spaces/dongyanggg/codestar-backend/codestar/server/models.py
-
curl -L -o models.py https://huggingface.co/spaces/dongyanggg/codestar-backend/resolve/main/codestar/server/models.py
1.66 kB
| """Data models for CodeStar Judge API and statistics.""" | |
| from __future__ import annotations | |
| from enum import Enum | |
| from typing import Any, Dict, List, Optional | |
| from pydantic import BaseModel, Field | |
| class JudgeTaskStatus(str, Enum): | |
| QUEUED = "queued" | |
| RUNNING = "running" | |
| WAKING_UP = "waking_up" | |
| COMPLETED = "completed" | |
| NETWORK_FAILED = "network_failed" | |
| class AsyncJudgeRequest(BaseModel): | |
| problem_slug: str = Field(..., max_length=128) | |
| code: str = Field(..., max_length=65536) | |
| custom_testcase: Optional[str] = Field(None, max_length=16384) | |
| is_test: bool = False | |
| class AsyncJudgeSubmitResponse(BaseModel): | |
| task_id: str | |
| status: str = "queued" | |
| created_at: str | |
| class AsyncJudgeResult(BaseModel): | |
| status: str | |
| passed: int | |
| total: int | |
| execution_time_ms: float | |
| peak_memory_mb: float | |
| beat_time_percent: Optional[float] = None | |
| beat_memory_percent: Optional[float] = None | |
| message: str | |
| passed_count: Optional[int] = None | |
| total_count: Optional[int] = None | |
| beats_runtime_pct: Optional[float] = None | |
| beats_memory_pct: Optional[float] = None | |
| cases: Optional[List[Dict[str, Any]]] = None | |
| stdout: Optional[str] = None | |
| class AsyncJudgeTaskResponse(BaseModel): | |
| task_id: str | |
| status: str | |
| result: Optional[Dict[str, Any]] = None | |
| error: Optional[str] = None | |
| class ProblemStats(BaseModel): | |
| slug: str | |
| total_submissions: int | |
| accepted_submissions: int | |
| pass_rate: Optional[float] = None | |
| has_sufficient_data: bool | |
| display_pass_rate: str | |
| execution_time_p50_ms: Optional[float] = None | |
| peak_memory_p50_mb: Optional[float] = None | |