Flatten GitHub API file payloads from a single page or gh --slurp pages.
(payload: object)
| 302 | |
| 303 | |
| 304 | def normalize_pr_files_payload(payload: object) -> list[dict[str, object]]: |
| 305 | """Flatten GitHub API file payloads from a single page or gh --slurp pages.""" |
| 306 | if not isinstance(payload, list): |
| 307 | raise ValueError("GitHub PR files payload must be a JSON array") |
| 308 | |
| 309 | files: list[dict[str, object]] = [] |
| 310 | for item in payload: |
| 311 | if isinstance(item, list): |
| 312 | files.extend(normalize_pr_files_payload(item)) |
| 313 | continue |
| 314 | if not isinstance(item, dict): |
| 315 | raise ValueError("GitHub PR files payload entries must be objects") |
| 316 | files.append(item) |
| 317 | return files |
| 318 | |
| 319 | |
| 320 | def github_status_to_name_status(status: str) -> str: |
no outgoing calls
no test coverage detected