Skip to content

Commit

Permalink
Rename zarr.storage.RemoteStore to FsspecStore
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Jan 14, 2025
1 parent 4f2a4b1 commit 50e43c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions ome_zarr/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections.abc import Iterator
from typing import Any, Optional

from zarr.storage import LocalStore, RemoteStore
from zarr.storage import FsspecStore, LocalStore

LOGGER = logging.getLogger("ome_zarr.format")

Expand Down Expand Up @@ -60,7 +60,7 @@ def matches(self, metadata: dict) -> bool: # pragma: no cover
raise NotImplementedError()

@abstractmethod
def init_store(self, path: str, mode: str = "r") -> RemoteStore:
def init_store(self, path: str, mode: str = "r") -> FsspecStore | LocalStore:
raise NotImplementedError()

# @abstractmethod
Expand Down Expand Up @@ -134,22 +134,22 @@ def matches(self, metadata: dict) -> bool:
LOGGER.debug("%s matches %s?", self.version, version)
return version == self.version

def init_store(self, path: str, mode: str = "r") -> RemoteStore | LocalStore:
def init_store(self, path: str, mode: str = "r") -> FsspecStore | LocalStore:
"""
Not ideal. Stores should remain hidden
"dimension_separator" is specified at array creation time
"""

if path.startswith(("http", "s3")):
store = RemoteStore.from_url(
store = FsspecStore.from_url(
path,
storage_options=None,
read_only=(mode in ("r", "r+", "a")),
)
else:
# No other kwargs supported
store = LocalStore(path, read_only=(mode in ("r", "r+", "a")))
LOGGER.debug("Created nested RemoteStore(%s, %s)", path, mode)
LOGGER.debug("Created nested FsspecStore(%s, %s)", path, mode)
return store

def generate_well_dict(
Expand Down
10 changes: 5 additions & 5 deletions ome_zarr/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import dask.array as da
import zarr
from zarr.storage import LocalStore, RemoteStore, StoreLike
from zarr.storage import FsspecStore, LocalStore, StoreLike

from .format import CurrentFormat, Format, detect_format
from .types import JSONDict
Expand Down Expand Up @@ -40,7 +40,7 @@ def __init__(
self.__path = str(path.resolve())
elif isinstance(path, str):
self.__path = path
elif isinstance(path, RemoteStore):
elif isinstance(path, FsspecStore):
self.__path = path.path
elif isinstance(path, LocalStore):
self.__path = str(path.root)
Expand All @@ -50,9 +50,9 @@ def __init__(
loader = fmt
if loader is None:
loader = CurrentFormat()
self.__store: RemoteStore = (
self.__store: FsspecStore = (
path
if isinstance(path, RemoteStore)
if isinstance(path, FsspecStore)
else loader.init_store(self.__path, mode)
)
self.__init_metadata()
Expand Down Expand Up @@ -132,7 +132,7 @@ def path(self) -> str:
return self.__path

@property
def store(self) -> RemoteStore:
def store(self) -> FsspecStore:
"""Return the initialized store for this location"""
assert self.__store is not None
return self.__store
Expand Down

0 comments on commit 50e43c1

Please sign in to comment.