mirror of
https://github.com/google-deepmind/alphafold3.git
synced 2026-06-02 11:54:36 +08:00
wrap reader into io.BufferedReader.
PiperOrigin-RevId: 889374560 Change-Id: Ie829d2eb1f06dc024b1848747540b50c11e8d9d6
This commit is contained in:
committed by
Copybara-Service
parent
02650a5ded
commit
0f82e0c94c
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user