fix(harness): support bounded provenance hashing on Python 3.10

This commit is contained in:
Yujong Lee 2026-09-05 13:28:08 -07:00
parent 75ae4d591a
commit 878f0da9ab

View file

@ -17,8 +17,11 @@ from .models import Invocation, Ready, Timing
def file_sha256(path: Path) -> str:
digest: Final = hashlib.sha256()
with path.open("rb") as source:
return hashlib.file_digest(source, "sha256").hexdigest()
for chunk in iter(lambda: source.read(256 * 1024), b""):
digest.update(chunk)
return digest.hexdigest()
def _ready(response: OCRResponse) -> Ready: