Spaces:
Runtime error
Runtime error
Download app/models/patch.py from simhaa-hat/ai-learning-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/spaces/simhaa-hat/ai-learning-dashboard/resolve/main/app/models/patch.py
- Command line
-
hf download hf://spaces/simhaa-hat/ai-learning-dashboard/app/models/patch.py
-
curl -L -o patch.py https://huggingface.co/spaces/simhaa-hat/ai-learning-dashboard/resolve/main/app/models/patch.py
1.45 kB
| """Patch document — code fix generated by the Program Repair Agent.""" | |
| from enum import StrEnum | |
| from beanie import PydanticObjectId | |
| from pydantic import Field | |
| from app.models.base import BaseDocument | |
| class PatchStrategy(StrEnum): | |
| """Strategy used to generate the patch.""" | |
| MINIMAL = "minimal" | |
| DEFENSIVE = "defensive" | |
| SAFE = "safe" | |
| REFACTOR = "refactor" | |
| TEMPLATE_BASED = "template_based" | |
| LLM_GENERATED = "llm_generated" | |
| class PatchStatus(StrEnum): | |
| CANDIDATE = "candidate" | |
| VALIDATING = "validating" | |
| ACCEPTED = "accepted" | |
| REJECTED = "rejected" | |
| class Patch(BaseDocument): | |
| """A code patch generated by the Program Repair Agent. | |
| Multiple candidate patches may be generated per bug. Only patches | |
| that pass validation are accepted. | |
| """ | |
| project_id: PydanticObjectId | |
| project_name: str = "" | |
| bug_report_id: PydanticObjectId | None = None | |
| strategy: PatchStrategy | |
| status: PatchStatus = Field(default=PatchStatus.CANDIDATE) | |
| diff: str = Field(description="Unified diff of the patch") | |
| file_path: str = "" | |
| description: str = "" | |
| confidence: float = Field(default=0.0, ge=0.0, le=1.0) | |
| rejection_reason: str = "" | |
| commit_sha: str = "" | |
| class Settings: | |
| name = "patches" | |
| use_state_management = True | |
| indexes = [ | |
| "project_id", | |
| "bug_report_id", | |
| ] | |