(data_dir: Path, difficulty: str = None)
| 68 | |
| 69 | |
| 70 | def find_task_files(data_dir: Path, difficulty: str = None) -> List[Path]: |
| 71 | |
| 72 | task_files = [] |
| 73 | |
| 74 | for dir_path in data_dir.iterdir(): |
| 75 | if not dir_path.is_dir(): |
| 76 | continue |
| 77 | |
| 78 | |
| 79 | if not any(dir_path.glob("task_*.json")): |
| 80 | continue |
| 81 | |
| 82 | |
| 83 | difficulties = [difficulty] if difficulty else ["simple", "middle", "hard"] |
| 84 | |
| 85 | for diff in difficulties: |
| 86 | |
| 87 | standard_task = dir_path / f"task_{diff}_data.json" |
| 88 | if standard_task.exists(): |
| 89 | task_files.append(standard_task) |
| 90 | |
| 91 | |
| 92 | multi_task = dir_path / f"task_{diff}_mul_data.json" |
| 93 | if multi_task.exists(): |
| 94 | task_files.append(multi_task) |
| 95 | |
| 96 | return task_files |
| 97 | |
| 98 | |
| 99 | def parse_task_file(task_file: Path) -> Tuple[str, str, List[str]]: |
nothing calls this directly
no outgoing calls
no test coverage detected