Skip to content

Commit 61b9404

Browse files
Unnecessary comprehension (#1996)
* Unnecessary comprehension `all` can take a generator. * Unnecessary comprehension `tuple` can take a generator.
1 parent 50235c0 commit 61b9404

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/zarr/indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ def __init__(self, selection: CoordinateSelection, shape: ChunkCoords, chunk_gri
10231023
# flatten selection
10241024
selection_broadcast = tuple(dim_sel.reshape(-1) for dim_sel in selection_broadcast)
10251025
chunks_multi_index_broadcast = tuple(
1026-
[dim_chunks.reshape(-1) for dim_chunks in chunks_multi_index_broadcast]
1026+
dim_chunks.reshape(-1) for dim_chunks in chunks_multi_index_broadcast
10271027
)
10281028

10291029
# ravel chunk indices

src/zarr/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def update_attributes(self, attributes: dict[str, JSON]) -> Self:
436436
def parse_dimension_names(data: None | Iterable[str]) -> tuple[str, ...] | None:
437437
if data is None:
438438
return data
439-
elif all([isinstance(x, str) for x in data]):
439+
elif all(isinstance(x, str) for x in data):
440440
return tuple(data)
441441
else:
442442
msg = f"Expected either None or a iterable of str, got {type(data)}"

0 commit comments

Comments
 (0)