Skip to content

Commit

Permalink
remove nested if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
VinzentRisch committed Sep 12, 2024
1 parent d6f7a8b commit 7d57c4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions rescript/bv_brc.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,13 @@ def parameter_validation(rql_query=None,
# or metadata
for parameter_1 in ["rql_query", "metadata"]:
for parameter_2, value in local.items():
if parameter_2 != parameter_1:
if parameter_2 != "data_type":
if local[parameter_1] is not None and value is not None:
raise ValueError(
f"Parameters '{parameter_1}' and '{parameter_2}' "
"can't be used simultaneously.")
if (parameter_2 != parameter_1 and
parameter_2 != "data_type" and
local[parameter_1] is not None and
value is not None):
raise ValueError(
f"Parameters '{parameter_1}' and '{parameter_2}' "
"can't be used simultaneously.")

# Error if ids or data_fields is specified without the other
if (ids and not data_field) or (data_field and not ids):
Expand Down
2 changes: 1 addition & 1 deletion rescript/tests/test_bv_brc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
get_sequences, get_taxonomy, create_taxonomy


class TestIDListHandling(TestPluginBase):
class TestParameterValidation(TestPluginBase):
package = 'rescript.tests'

def test_missing_data_type(self):
Expand Down

0 comments on commit 7d57c4c

Please sign in to comment.