Skip to content

Commit

Permalink
refactor: remove continue statement
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirman committed Nov 16, 2024
1 parent 4b18ae0 commit a2c4f1a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/aind_data_schema/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,8 @@ def unit_validator(cls, values):
# Go through all the values again, if any value matches the variable name
# and is set, then the unit needs to be set as well
for variable_name, variable_value in values:
if variable_name == var_name:
if variable_value:
raise ValueError(f"Unit {unit_name} is required when {variable_name} is set.")
# if we found our variable and it was None, we can move on
continue
if variable_name == var_name and variable_value:
raise ValueError(f"Unit {unit_name} is required when {variable_name} is set.")

# One more time, now looking for the multi-variable condition
for variable_name, variable_value in values:
Expand Down

0 comments on commit a2c4f1a

Please sign in to comment.