Download server/tasks/task_1_build_errors.py from jester1177/cloudnative-devops-debug-env: direct link, hf CLI and curl.
- Browser
- Download file 1.68 kB
-
https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/4c982102abd00794f327eab5f159b166d71a5347/server/tasks/task_1_build_errors.py
- Command line
-
hf download hf://spaces/jester1177/cloudnative-devops-debug-env@4c982102abd00794f327eab5f159b166d71a5347/server/tasks/task_1_build_errors.py
-
curl -L -o task_1_build_errors.py https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/4c982102abd00794f327eab5f159b166d71a5347/server/tasks/task_1_build_errors.py
1.68 kB
| from __future__ import annotations | |
| import random | |
| from typing import Dict, Optional | |
| from server.models import TaskDifficulty | |
| from server.tasks.base import BaseTask | |
| class DockerfileSyntaxTask(BaseTask): | |
| NAME = "Dockerfile Syntax Errors" | |
| DESCRIPTION = "Fix syntax and instruction errors in Dockerfiles" | |
| DIFFICULTY = TaskDifficulty.EASY | |
| AVAILABLE_SECRETS = [] | |
| SCENARIOS = [ | |
| { | |
| "id": "typo_filename", | |
| "files": [ | |
| { | |
| "path": "Dockerfile", | |
| "type": "dockerfile", | |
| "content": "FROM python:3.9-slim\nWORKDIR /app\nCOPY requirments.txt .\nRUN pip install -r requirements.txt", | |
| }, | |
| {"path": "requirements.txt", "type": "requirements", "content": "requests==2.31.0"}, | |
| ], | |
| "error": { | |
| "phase": "docker_build", | |
| "message": "COPY failed: file not found in build context: requirments.txt", | |
| "line_hint": 3, | |
| }, | |
| "expected_fixes": [ | |
| { | |
| "file": "Dockerfile", | |
| "type": "contains", | |
| "expected": "COPY requirements.txt", | |
| "hint": "Check spelling of requirements filename", | |
| } | |
| ], | |
| } | |
| ] | |
| def load_scenario(self, scenario_id: Optional[str] = None) -> Dict: | |
| if scenario_id: | |
| for scenario in self.SCENARIOS: | |
| if scenario["id"] == scenario_id: | |
| return scenario | |
| raise ValueError(f"Unknown scenario: {scenario_id}") | |
| return random.choice(self.SCENARIOS) | |