(root_label: str | None, root: Path, root_patterns: list[str])
| 480 | seen: set[Path] = set() |
| 481 | |
| 482 | def collect(root_label: str | None, root: Path, root_patterns: list[str]) -> None: |
| 483 | prefix = "" if not root_label else f"{root_label}/" |
| 484 | for pattern in root_patterns: |
| 485 | for path in root.glob(pattern): |
| 486 | if path.is_file() and path not in seen: |
| 487 | seen.add(path) |
| 488 | artifacts.append( |
| 489 | { |
| 490 | "path": f"{prefix}{path.relative_to(root)}", |
| 491 | "bytes": path.stat().st_size, |
| 492 | "modified_at": datetime.fromtimestamp(path.stat().st_mtime) |
| 493 | .astimezone() |
| 494 | .isoformat(timespec="seconds"), |
| 495 | "sha256": sha256_file(path) |
| 496 | if path.stat().st_size <= MAX_AUTO_CHECKSUM_BYTES |
| 497 | else "", |
| 498 | "sha256_skipped_reason": ( |
| 499 | None |
| 500 | if path.stat().st_size <= MAX_AUTO_CHECKSUM_BYTES |
| 501 | else f"file exceeds {MAX_AUTO_CHECKSUM_BYTES} bytes auto-checksum threshold" |
| 502 | ), |
| 503 | } |
| 504 | ) |
| 505 | |
| 506 | collect(None, run_dir, patterns) |
| 507 | if extra_roots: |
no test coverage detected