(inputs: dict[str, Any] | None)
| 270 | |
| 271 | |
| 272 | def input_checksums(inputs: dict[str, Any] | None) -> list[dict[str, Any]]: |
| 273 | seen: set[Path] = set() |
| 274 | checksums: list[dict[str, Any]] = [] |
| 275 | for path in _iter_existing_paths(inputs or {}): |
| 276 | if path in seen: |
| 277 | continue |
| 278 | seen.add(path) |
| 279 | size = path.stat().st_size |
| 280 | record: dict[str, Any] = {"path": str(path), "bytes": size} |
| 281 | if size <= MAX_AUTO_CHECKSUM_BYTES: |
| 282 | record["sha256"] = sha256_file(path) |
| 283 | else: |
| 284 | record["sha256"] = None |
| 285 | record["sha256_skipped_reason"] = ( |
| 286 | f"file exceeds {MAX_AUTO_CHECKSUM_BYTES} bytes auto-checksum threshold" |
| 287 | ) |
| 288 | checksums.append(record) |
| 289 | return sorted(checksums, key=lambda item: item["path"]) |
| 290 | |
| 291 | |
| 292 | def _flatten_declared_paths(value: Any, prefix: str = "") -> list[dict[str, str]]: |
no test coverage detected