From f6d728f7fe5040b2613516c2ce1dcc8d210cfb4f Mon Sep 17 00:00:00 2001 From: rogthefrog Date: Thu, 19 Dec 2024 17:24:49 -0800 Subject: [PATCH] exit early in case of error --- src/modelbench/hazards.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modelbench/hazards.py b/src/modelbench/hazards.py index 18a0f5b9..1fb555b6 100644 --- a/src/modelbench/hazards.py +++ b/src/modelbench/hazards.py @@ -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)