Skip to content

Commit 4d2755f

Browse files
committed
RF: Simplify logic
1 parent 2d0040d commit 4d2755f

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

nibabel/_compression.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,14 @@ def zstd_open(
183183
alert_future_error(
184184
'The level_or_option parameter will be removed in a future version of nibabel',
185185
'7.0',
186-
warning_rec='This warning can be silenced by using the separate '
187-
'level/option parameters',
186+
warning_rec='This warning can be silenced by using the separate level/option parameters',
188187
error_rec='Future errors can be avoided by using the separate level/option parameters',
189188
error_class=TypeError,
190189
)
191-
level_or_option_provided = sum(
192-
(level_or_option is not None, level is not None, options is not None)
193-
)
194-
if level_or_option_provided > 1:
190+
if level is not None or options is not None:
195191
raise ValueError('Only one of level_or_option, level or options may be specified')
196-
if level_or_option is not None:
197-
if isinstance(level_or_option, int):
198-
level = level_or_option
199-
else:
200-
options = level_or_option
192+
if isinstance(level_or_option, int):
193+
level = level_or_option
194+
else:
195+
options = level_or_option
201196
return zstd.ZstdFile(filename, mode, level=level, options=options, zstd_dict=zstd_dict)

0 commit comments

Comments
 (0)