| 149 | |
| 150 | |
| 151 | def selected_cases(catalog: dict[str, Any], only: set[str], family: str | None) -> list[dict[str, Any]]: |
| 152 | cases = catalog.get("cases", []) |
| 153 | out: list[dict[str, Any]] = [] |
| 154 | for case in cases: |
| 155 | case_id = case["id"] |
| 156 | if only and case_id not in only: |
| 157 | continue |
| 158 | if family and case.get("family") != family: |
| 159 | continue |
| 160 | out.append(case) |
| 161 | if only: |
| 162 | found = {case["id"] for case in out} |
| 163 | missing = sorted(only - found) |
| 164 | if missing: |
| 165 | raise RuntimeError("unknown case id(s): " + ", ".join(missing)) |
| 166 | return out |
| 167 | |
| 168 | |
| 169 | def request_to_args(request: dict[str, Any], repo_root: Path) -> list[str]: |