Skip to content

Commit 0980477

Browse files
Apply Pylint rule R1708 (stop-iteration-return)
Do not raise StopIteration in generator, use return statement instead
1 parent eca843b commit 0980477

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/zarr/core/group.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,11 +3208,13 @@ async def create_hierarchy(
32083208
nodes_parsed = _parse_hierarchy_dict(data=nodes_normed_keys)
32093209
redundant_implicit_groups = []
32103210

3211-
# empty hierarchies should be a no-op
3212-
if len(nodes_parsed) > 0:
3211+
try:
32133212
# figure out which zarr format we are using
32143213
zarr_format = next(iter(nodes_parsed.values())).zarr_format
3215-
3214+
except StopIteration:
3215+
# empty hierarchies should be a no-op
3216+
pass
3217+
else:
32163218
# check which implicit groups will require materialization
32173219
implicit_group_keys = tuple(
32183220
filter(lambda k: isinstance(nodes_parsed[k], ImplicitGroupMarker), nodes_parsed)

0 commit comments

Comments
 (0)