(scan_dir: Path, relative_path: str)
| 2803 | |
| 2804 | |
| 2805 | def open_scan_local_file(scan_dir: Path, relative_path: str) -> Any: |
| 2806 | parsed = PurePosixPath(relative_path) |
| 2807 | if parsed.is_absolute() or not parsed.parts or ".." in parsed.parts: |
| 2808 | raise SystemExit("Patch path must identify a scan-local regular file.") |
| 2809 | scan_dir = require_canonical_scan_directory(scan_dir) |
| 2810 | try: |
| 2811 | file_fd = open_scan_local_file_descriptor( |
| 2812 | scan_dir, |
| 2813 | parsed.as_posix(), |
| 2814 | "Patch path", |
| 2815 | ) |
| 2816 | return os.fdopen(file_fd, "rb") |
| 2817 | except (ContractError, OSError) as exc: |
| 2818 | raise SystemExit("Patch path must identify a scan-local regular file.") from exc |
| 2819 | |
| 2820 | |
| 2821 | def index_findings( |
no test coverage detected