Skip to content

Commit 4081199

Browse files
authored
Provide default if .pop(...) errors (#655)
As `.pop(...)` already catches the `KeyError` if a default value is supplied, use that to simplify the code a bit.
1 parent c0358a9 commit 4081199

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

zarr/n5.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,8 @@ def group_metadata_to_n5(group_metadata):
311311

312312
def group_metadata_to_zarr(group_metadata):
313313
'''Convert group metadata from N5 to zarr format.'''
314-
try:
315-
group_metadata.pop('n5')
316-
except KeyError:
317-
# This only exists at the top level
318-
pass
314+
# This only exists at the top level
315+
group_metadata.pop('n5', None)
319316
group_metadata['zarr_format'] = ZARR_FORMAT
320317
return group_metadata
321318

0 commit comments

Comments
 (0)