Spaces:
Sleeping
Sleeping
Download server/inputs/simulated/task_selector.py from Hugging-coder14/toolforge-env: direct link, hf CLI and curl.
- Browser
- Download file 953 Bytes
-
https://huggingface.co/spaces/Hugging-coder14/toolforge-env/resolve/main/server/inputs/simulated/task_selector.py
- Command line
-
hf download hf://spaces/Hugging-coder14/toolforge-env/server/inputs/simulated/task_selector.py
-
curl -L -o task_selector.py https://huggingface.co/spaces/Hugging-coder14/toolforge-env/resolve/main/server/inputs/simulated/task_selector.py
953 Bytes
| from typing import Dict, Any | |
| from server.inputs.simulated.tasks import TASKS | |
| TASK_ID_MAP = { | |
| "easy": "easy-deployment-sprints", | |
| "medium": "medium-traffic-readiness", | |
| "hard": "hard-project-legacy-migration", | |
| } | |
| class TaskSelector: | |
| def __init__(self): | |
| pass | |
| def next_task_list(self, task_id: str) -> Dict: | |
| # Prefer direct internal IDs; if not provided, resolve deterministic aliases. | |
| resolved_task_id = task_id | |
| direct_match = next((item for item in TASKS if item.get("task_id") == resolved_task_id), None) | |
| if direct_match is not None: | |
| return direct_match | |
| resolved_task_id = TASK_ID_MAP.get(task_id, task_id) | |
| match = next((item for item in TASKS if item.get("task_id") == resolved_task_id), None) | |
| if match is None: | |
| raise ValueError(f"Unknown task_id: {task_id} (resolved: {resolved_task_id})") | |
| return match |