Skip to content

Commit 82385fd

Browse files
Apply ruff/flake8-simplify rule SIM102
SIM102 Use a single `if` statement instead of nested `if` statements
1 parent d5c58c2 commit 82385fd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

numcodecs/registry.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ def get_codec(config):
4242
config = dict(config)
4343
codec_id = config.pop('id', None)
4444
cls = codec_registry.get(codec_id)
45-
if cls is None:
46-
if codec_id in entries:
47-
logger.debug("Auto loading codec '%s' from entrypoint", codec_id)
48-
cls = entries[codec_id].load()
49-
register_codec(cls, codec_id=codec_id)
45+
if cls is None and codec_id in entries:
46+
logger.debug("Auto loading codec '%s' from entrypoint", codec_id)
47+
cls = entries[codec_id].load()
48+
register_codec(cls, codec_id=codec_id)
5049
if cls:
5150
return cls.from_config(config)
5251
raise ValueError(f'codec not available: {codec_id!r}')

0 commit comments

Comments
 (0)