From cdadb53dbc2c6626ee7d557ebb9216a6ba65705c Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Tue, 22 Oct 2024 20:38:01 -0700 Subject: [PATCH] to_posix in LocalStore --- .github/workflows/hypothesis.yaml | 2 +- src/zarr/storage/local.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/hypothesis.yaml b/.github/workflows/hypothesis.yaml index 85d48bddb1..1029063ef4 100644 --- a/.github/workflows/hypothesis.yaml +++ b/.github/workflows/hypothesis.yaml @@ -26,7 +26,7 @@ jobs: strategy: matrix: python-version: ['3.11'] - numpy-version: ['1.26'] + numpy-version: ['2.1'] dependency-set: ["optional"] steps: diff --git a/src/zarr/storage/local.py b/src/zarr/storage/local.py index 5c03009a97..e5751d6ee6 100644 --- a/src/zarr/storage/local.py +++ b/src/zarr/storage/local.py @@ -219,17 +219,17 @@ async def exists(self, key: str) -> bool: async def list(self) -> AsyncGenerator[str, None]: # docstring inherited - to_strip = str(self.root) + "/" + to_strip = self.root.as_posix() + "/" for p in list(self.root.rglob("*")): if p.is_file(): - yield str(p).replace(to_strip, "") + yield p.as_posix().replace(to_strip, "") async def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]: # docstring inherited - to_strip = os.path.join(str(self.root / prefix)) + to_strip = (self.root / prefix).as_posix() + "/" # TODO: fixme in 2430 for p in (self.root / prefix).rglob("*"): if p.is_file(): - yield str(p.relative_to(to_strip)) + yield p.as_posix().replace(to_strip, "") async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]: # docstring inherited @@ -239,6 +239,6 @@ async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]: try: key_iter = base.iterdir() for key in key_iter: - yield str(key).replace(to_strip, "") + yield key.as_posix().replace(to_strip, "") except (FileNotFoundError, NotADirectoryError): pass