Skip to content

Add ZipStore.with_read_only #3200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/zarr/storage/_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@
self.compression = compression
self.allowZip64 = allowZip64

def with_read_only(self, read_only: bool = False) -> ZipStore:
# docstring inherited
store = type(self)(

Check warning on line 95 in src/zarr/storage/_zip.py

View check run for this annotation

Codecov / codecov/patch

src/zarr/storage/_zip.py#L95

Added line #L95 was not covered by tests
path=self.path,
mode='r',
read_only=read_only,
compression=self.compression,
allowZip64=self.allowZip64,
)
store._sync_open()
return store

Check warning on line 103 in src/zarr/storage/_zip.py

View check run for this annotation

Codecov / codecov/patch

src/zarr/storage/_zip.py#L102-L103

Added lines #L102 - L103 were not covered by tests

def _sync_open(self) -> None:
if self._is_open:
raise ValueError("store is already open")
Expand Down
Loading