Return the hex SHA-256 digest of *path*.
(path: Path)
| 18 | |
| 19 | |
| 20 | def _sha256(path: Path) -> str: |
| 21 | """Return the hex SHA-256 digest of *path*.""" |
| 22 | h = hashlib.sha256() |
| 23 | with open(path, "rb") as fh: |
| 24 | for chunk in iter(lambda: fh.read(8192), b""): |
| 25 | h.update(chunk) |
| 26 | return h.hexdigest() |
| 27 | |
| 28 | |
| 29 | def _validate_rel_path(rel: Path, root: Path) -> Path: |