Coverage for src/mlopus/mlflow/api/common/patterns.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-07-13 14:49 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-07-13 14:49 +0000
1import re
2import urllib.parse
4EXP_ID = re.compile(r"[\w\-]+")
5RUN_ID = re.compile(r"[\w\-]+")
6MODEL_NAME = re.compile(r"[\w\-./]+")
7MODEL_VERSION = re.compile(r"[\w\-.]+")
8TAG_PARAM_OR_METRIC_KEY = re.compile(r"[\w\-/]+")
11def encode_model_name(name: str) -> str:
12 """Encode model name to be used in URL or Path.
14 From the special chars allowed in the `MODEL_NAME` pattern,
15 only the slash (/) is excluded from safe chars.
16 """
17 return urllib.parse.quote(name, safe="_-.")