From e6d818c3bb8daf1b1193956b19be1f958075f83d Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 25 Sep 2024 09:18:16 +0200 Subject: [PATCH 1/2] Apply ruff/flynt rule FLY002 FLY002 Consider f-string instead of string join --- src/zarr/core/group.py | 2 +- src/zarr/store/remote.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zarr/core/group.py b/src/zarr/core/group.py index b09968b62a..d7ad960b14 100644 --- a/src/zarr/core/group.py +++ b/src/zarr/core/group.py @@ -676,7 +676,7 @@ async def _members( async for child_key, val in obj._members( max_depth=max_depth, current_depth=current_depth + 1 ): - yield "/".join([key, child_key]), val + yield f"{key}/{child_key}", val except KeyError: # keyerror is raised when `key` names an object (in the object storage sense), # as opposed to a prefix, in the store under the prefix associated with this group diff --git a/src/zarr/store/remote.py b/src/zarr/store/remote.py index 02bda6b1dd..7aea8a3780 100644 --- a/src/zarr/store/remote.py +++ b/src/zarr/store/remote.py @@ -234,6 +234,6 @@ async def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]: AsyncGenerator[str, None] """ - find_str = "/".join([self.path, prefix]) + find_str = f"{self.path}/{prefix}" for onefile in await self.fs._find(find_str, detail=False, maxdepth=None, withdirs=False): yield onefile.removeprefix(find_str) From 6a53c251abbd58ce59cc4207fc9e9cde5b86e35a Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 25 Sep 2024 09:19:12 +0200 Subject: [PATCH 2/2] Enforce ruff/flynt rules (FLY) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ed6c25893c..5f45d31831 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -208,6 +208,7 @@ extend-exclude = [ [tool.ruff.lint] extend-select = [ "B", # flake8-bugbear + "FLY", # flynt "I", # isort "ISC", # flake8-implicit-str-concat "PGH", # pygrep-hooks