Spaces:
Sleeping
Sleeping
Download models.py from Tanish2416/RepoRepair: direct link, hf CLI and curl.
- Browser
- Download file 2.48 kB
-
https://huggingface.co/spaces/Tanish2416/RepoRepair/resolve/main/models.py
- Command line
-
hf download hf://spaces/Tanish2416/RepoRepair/models.py
-
curl -L -o models.py https://huggingface.co/spaces/Tanish2416/RepoRepair/resolve/main/models.py
2.48 kB
| """Shared data models for RepoRepair.""" | |
| from dataclasses import dataclass | |
| from typing import Any, Optional | |
| class Issue: | |
| """Represents a GitHub issue.""" | |
| number: int | |
| title: str | |
| body: str | |
| state: str | |
| labels: list[str] | |
| author: str | |
| url: str | |
| raw: Any = None | |
| class SearchResult: | |
| """Code search result.""" | |
| file_path: str | |
| content: str | |
| relevance_score: float | |
| line_numbers: Optional[tuple[int, int]] = None | |
| class CodeChange: | |
| """Represents a code change.""" | |
| file_path: str | |
| original_content: str | |
| new_content: str | |
| explanation: str | |
| class TestResult: | |
| """Test execution result.""" | |
| success: bool | |
| output: str | |
| exit_code: int | |
| duration: float | |
| class WorkflowResult: | |
| """Final result of the workflow.""" | |
| success: bool | |
| branch_name: Optional[str] = None | |
| files_changed: list[str] = None | |
| pr_url: Optional[str] = None | |
| error: Optional[str] = None | |
| # Transparency | |
| reasoning_trace: list[dict] = None | |
| def __post_init__(self): | |
| if self.files_changed is None: | |
| self.files_changed = [] | |
| if self.reasoning_trace is None: | |
| self.reasoning_trace = [] | |
| class ReasoningStep: | |
| """A reasoning step taken by an agent.""" | |
| agent: str | |
| message: str | |
| timestamp: float | |
| class AgentState: | |
| """State passed between agents in the workflow.""" | |
| owner: str | |
| repo: str | |
| issue_number: int | |
| issue: Issue | |
| repo_path: str | |
| # Transparency / Viewer | |
| reasoning_trace: list[ReasoningStep] = None | |
| def __post_init__(self): | |
| if self.reasoning_trace is None: | |
| self.reasoning_trace = [] | |
| # Planner outputs | |
| strategy: Optional[str] = None | |
| search_queries: Optional[list[str]] = None | |
| # Searcher outputs | |
| relevant_files: Optional[list[SearchResult]] = None | |
| # Coder outputs | |
| changes: Optional[list[CodeChange]] = None | |
| branch_name: Optional[str] = None | |
| # Validator outputs | |
| test_result: Optional[TestResult] = None | |
| validation_passed: bool = False | |
| # Final result | |
| pr_url: Optional[str] = None | |
| error: Optional[str] = None | |
| # Retry tracking | |
| retry_count: int = 0 | |
| max_retries: int = 3 | |