Spaces:
Sleeping
Sleeping
Download models.py from farishkhaan/code-review: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/farishkhaan/code-review/resolve/main/models.py
- Command line
-
hf download hf://spaces/farishkhaan/code-review/models.py
-
curl -L -o models.py https://huggingface.co/spaces/farishkhaan/code-review/resolve/main/models.py
1.26 kB
| from typing import Dict, Any, List, Optional | |
| from pydantic import BaseModel, Field | |
| from openenv_core.env_server.types import Action, Observation, State | |
| class CodeReviewAction(Action): | |
| action_type: str = Field(description="'classify_issue' | 'suggest_fix' | 'write_fix' | 'skip'") | |
| hunk_id: str = Field(description="ID of the hunk being reviewed") | |
| issue_type: str = Field(description="'bug' | 'style' | 'security' | 'performance' | 'none'") | |
| severity: str = Field(description="'critical' | 'major' | 'minor' | 'info'") | |
| suggestion: str = Field(default="", description="free-text fix or actual corrected code") | |
| class CodeReviewObservation(Observation): | |
| hunks: List[Dict] = Field(description="remaining hunks (id, language, diff only)") | |
| current_hunk: Optional[Dict] = Field(description="the hunk to act on right now") | |
| task_id: str = Field(description="which task is active") | |
| progress: float = Field(description="0.0 to 1.0 completion ratio") | |
| step_count: int = Field(description="current step") | |
| last_feedback: Optional[str] = Field(description="reward feedback from previous step") | |
| class CodeReviewState(State): | |
| task_id: str = "easy_classify" | |
| visited_hunks: List[str] = [] | |
| accumulated_rewards: float = 0.0 |