fix: don't restrict spaces - explicitly defined space should win

This commit is contained in:
Matthias
2025-11-06 20:43:42 +01:00
parent f93c906614
commit 524ceebcbb

View File

@@ -174,24 +174,15 @@ def detect_all_parameters(
attr = getattr(obj, attr_name) attr = getattr(obj, attr_name)
if not issubclass(attr.__class__, BaseParameter): if not issubclass(attr.__class__, BaseParameter):
continue continue
auto_category: str | None = None if not attr.category:
# Category auto detection # Category auto detection
for category in auto_categories: for category in auto_categories:
if attr_name.startswith(category + "_"): if attr_name.startswith(category + "_"):
auto_category = category attr.category = category
break break
if auto_category is None and attr.category is None: if attr.category is None:
raise OperationalException(f"Cannot determine parameter space for {attr_name}.") raise OperationalException(f"Cannot determine parameter space for {attr_name}.")
if auto_category is not None and attr.category is None:
attr.category = auto_category
if (
auto_category is not None
and attr.category is not None
and auto_category != attr.category
):
raise OperationalException(
f"Conflicting parameter space for {attr_name}: {auto_category} vs {attr.category}."
)
if attr.category in ("all", "default") or attr.category.isidentifier() is False: if attr.category in ("all", "default") or attr.category.isidentifier() is False:
raise OperationalException( raise OperationalException(
f"'{attr.category}' is not a valid space. Parameter: {attr_name}." f"'{attr.category}' is not a valid space. Parameter: {attr_name}."