Skip to content

Commit a95ec59

Browse files
committed
Check store type at runtime
1 parent c2cd6b8 commit a95ec59

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/zarr/storage/object_store.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,19 @@ def __eq__(self, value: object) -> bool:
4141
return bool(self.store.__eq__(value.store))
4242

4343
def __init__(self, store: _ObjectStore, *, read_only: bool = False) -> None:
44+
if not isinstance(
45+
store,
46+
(
47+
obs.store.AzureStore,
48+
obs.store.GCSStore,
49+
obs.store.HTTPStore,
50+
obs.store.S3Store,
51+
obs.store.LocalStore,
52+
obs.store.MemoryStore,
53+
),
54+
):
55+
raise TypeError(f"expected ObjectStore class, got {store!r}")
4456
self.store = store
45-
4657
super().__init__(read_only=read_only)
4758

4859
def __str__(self) -> str:

0 commit comments

Comments
 (0)