(value: str | None, path: Path | None)
| 637 | |
| 638 | |
| 639 | def capability_preflight_input(value: str | None, path: Path | None) -> str | None: |
| 640 | if path is None: |
| 641 | return value |
| 642 | try: |
| 643 | if path.stat().st_size > MAX_CAPABILITY_PREFLIGHT_INPUT_JSON_BYTES: |
| 644 | raise SystemExit( |
| 645 | "Capability preflight must be no larger than " |
| 646 | f"{MAX_CAPABILITY_PREFLIGHT_INPUT_JSON_BYTES} bytes." |
| 647 | ) |
| 648 | return path.read_text(encoding="utf-8") |
| 649 | except (OSError, UnicodeError) as exc: |
| 650 | raise SystemExit("Capability preflight JSON file could not be read as UTF-8.") from exc |
| 651 | |
| 652 | |
| 653 | def _require_object_keys( |
no test coverage detected