From 8743ddce3b149303eed9b8efce9901aa37050539 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 27 Jun 2024 08:22:03 +0200 Subject: [PATCH] Unnecessary comprehension Use `list(...)` instead. --- src/zarr/abc/codec.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/zarr/abc/codec.py b/src/zarr/abc/codec.py index 1d7106e25a..8ce9cc0043 100644 --- a/src/zarr/abc/codec.py +++ b/src/zarr/abc/codec.py @@ -187,10 +187,7 @@ async def decode_partial( Iterable[NDBuffer | None] """ return await concurrent_map( - [ - (byte_getter, selection, chunk_spec) - for byte_getter, selection, chunk_spec in batch_info - ], + list(batch_info), self._decode_partial_single, config.get("async.concurrency"), ) @@ -227,10 +224,7 @@ async def encode_partial( The chunk spec contains information about the chunk. """ await concurrent_map( - [ - (byte_setter, chunk_array, selection, chunk_spec) - for byte_setter, chunk_array, selection, chunk_spec in batch_info - ], + list(batch_info), self._encode_partial_single, config.get("async.concurrency"), ) @@ -402,7 +396,7 @@ async def batching_helper( batch_info: Iterable[tuple[CodecInput | None, ArraySpec]], ) -> list[CodecOutput | None]: return await concurrent_map( - [(chunk_array, chunk_spec) for chunk_array, chunk_spec in batch_info], + list(batch_info), noop_for_none(func), config.get("async.concurrency"), )