Skip to content

Commit 1c33512

Browse files
committed
Simplify validation and exception code logic
1 parent b170ff9 commit 1c33512

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

src/imcflibs/imagej/bdv.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,9 @@ def check_definition_option(self, value):
561561
-------
562562
dict(str, str): dictionary containing the correct string definition.
563563
"""
564-
if value not in [
565-
"single",
566-
"multi_single",
567-
"multi_multi",
568-
]:
569-
raise ValueError(
570-
"Value must be one of single, multi_multi or multi_single"
571-
)
564+
valid = ["single", "multi_single", "multi_multi"]
565+
if value not in valid:
566+
raise ValueError("Value must be one of: %s" % valid)
572567

573568
return {
574569
"single": SINGLE_FILE,
@@ -591,12 +586,14 @@ def check_definition_option_ang_ill(self, value):
591586
-------
592587
dict(str, str): dictionary containing the correct string definition.
593588
"""
594-
if value not in [
595-
"single",
596-
"multi_multi",
597-
]:
589+
valid = ["single", "multi_multi"]
590+
if value not in valid:
598591
raise ValueError(
599-
"Value must be one of single, multi_multi. Support for multi_single is not available for angles and illuminations"
592+
(
593+
"Value must be one of: %s. Support for 'multi_single' is "
594+
"not available for angles and illuminations."
595+
)
596+
% valid
600597
)
601598

602599
return {

0 commit comments

Comments
 (0)