33import importlib .util
44import json
55from pathlib import Path
6- from typing import TYPE_CHECKING , Any , Literal , Self , TypeAlias
6+ from typing import TYPE_CHECKING , Any , Literal , TypeAlias
77
88from zarr .abc .store import ByteRequest , Store
99from zarr .core .buffer import Buffer , default_buffer_prototype
@@ -55,7 +55,9 @@ def read_only(self) -> bool:
5555 return self .store .read_only
5656
5757 @classmethod
58- async def open (cls , store : Store , path : str , mode : AccessModeLiteral | None = None ) -> Self :
58+ async def open (
59+ cls , store : Store , path : str , mode : AccessModeLiteral | None = None
60+ ) -> StorePath :
5961 """
6062 Open StorePath based on the provided mode.
6163
@@ -72,9 +74,6 @@ async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = No
7274 ------
7375 FileExistsError
7476 If the mode is 'w-' and the store path already exists.
75- ValueError
76- If the mode is not "r" and the store is read-only, or
77- if the mode is "r" and the store is not read-only.
7877 """
7978
8079 await store ._ensure_open ()
@@ -86,8 +85,6 @@ async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = No
8685
8786 if store .read_only and mode != "r" :
8887 raise ValueError (f"Store is read-only but mode is '{ mode } '" )
89- if not store .read_only and mode == "r" :
90- raise ValueError (f"Store is not read-only but mode is '{ mode } '" )
9188
9289 match mode :
9390 case "w-" :
0 commit comments