Skip to content

Commit

Permalink
exit early in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
rogthefrog committed Dec 20, 2024
1 parent d7fcd41 commit f6d728f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/modelbench/hazards.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,12 @@ def reference_standard_for(self, name):

def average_standard_across_references(self, locale: str = "", version: str = "1.0") -> float:
values = []
if version == "1.0":
if not locale:
raise ValueError("Locale is required for v1.0 scoring.")
locale = locale.lower()
values = [v for k, v in self.data["reference_standards"].items() if locale in k]
else:
if version != "1.0":
raise ValueError(f"Unsupported benchmark version: {version}")
if not locale:
raise ValueError("Locale is required for v1.0 scoring.")
locale = locale.lower()
values = [v for k, v in self.data["reference_standards"].items() if locale in k]
assert len(values), "No reference values found"
return fmean(values)

Expand Down

0 comments on commit f6d728f

Please sign in to comment.