Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mlflow/entities/model_registry/model_version_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

def get_canonical_stage(stage):
key = stage.lower()
if key not in _CANONICAL_MAPPING:
try:
# Direct dictionary lookup with exception handling for missing key
return _CANONICAL_MAPPING[key]
except KeyError:
raise MlflowException(
"Invalid Model Version stage: {}. Value must be one of {}.".format(
stage, ", ".join(ALL_STAGES)
),
f"Invalid Model Version stage: {stage}. Value must be one of {', '.join(ALL_STAGES)}.",
INVALID_PARAMETER_VALUE,
)
return _CANONICAL_MAPPING[key]