From 0f82e0c94c6e9cc5de36975e278eee853dc07cf9 Mon Sep 17 00:00:00 2001 From: Akvile Zemgulyte Date: Wed, 25 Mar 2026 12:25:09 -0700 Subject: [PATCH] wrap reader into io.BufferedReader. PiperOrigin-RevId: 889374560 Change-Id: Ie829d2eb1f06dc024b1848747540b50c11e8d9d6 --- src/alphafold3/model/params.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/alphafold3/model/params.py b/src/alphafold3/model/params.py index 2fa3407..b99d157 100644 --- a/src/alphafold3/model/params.py +++ b/src/alphafold3/model/params.py @@ -110,6 +110,7 @@ class _MultiFileIO(io.RawIOBase): def close(self): self._stack.close() + @property def closed(self) -> bool: return all(handle.closed for handle in self._handles) @@ -154,7 +155,8 @@ class _MultiFileIO(io.RawIOBase): def open_for_reading(model_files: list[pathlib.Path], is_compressed: bool): with contextlib.closing(_MultiFileIO(model_files)) as f: if is_compressed: - yield zstandard.ZstdDecompressor().stream_reader(f) + buffered = io.BufferedReader(f) + yield zstandard.ZstdDecompressor().stream_reader(buffered) else: yield f