Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use list comprehension where applicable #1555

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions zarr/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1754,17 +1754,15 @@ def test_accessed_chunks(shape, chunks, ops):
for ii, (optype, slices) in enumerate(ops):

# Resolve the slices into the accessed chunks for each dimension
chunks_per_dim = []
for N, C, sl in zip(shape, chunks, slices):
chunk_ind = np.arange(N, dtype=int)[sl] // C
chunks_per_dim.append(np.unique(chunk_ind))
chunks_per_dim = [
np.unique(np.arange(N, dtype=int)[sl] // C) for N, C, sl in zip(shape, chunks, slices)
]

# Combine and generate the cartesian product to determine the chunks keys that
# will be accessed
chunks_accessed = []
for comb in itertools.product(*chunks_per_dim):
chunks_accessed.append(".".join([str(ci) for ci in comb]))

chunks_accessed = (
".".join([str(ci) for ci in comb]) for comb in itertools.product(*chunks_per_dim)
)
counts_before = store.counter.copy()

# Perform the operation
Expand Down