MCPcopy Index your code
hub / github.com/feast-dev/feast / parse_version

Function parse_version

sdk/python/feast/version_utils.py:9–27  ·  view source on GitHub ↗

Parse a version string into (is_latest, version_number). Accepts "latest", "vN", or "versionN" (case-insensitive). Returns (True, 0) for "latest", (False, N) for pinned versions. Raises: ValueError: If the version string is invalid.

(version: str)

Source from the content-addressed store, hash-verified

7
8
9def parse_version(version: str) -> Tuple[bool, int]:
10 """Parse a version string into (is_latest, version_number).
11
12 Accepts "latest", "vN", or "versionN" (case-insensitive).
13 Returns (True, 0) for "latest", (False, N) for pinned versions.
14
15 Raises:
16 ValueError: If the version string is invalid.
17 """
18 if not version or version.lower() == LATEST_VERSION:
19 return True, 0
20
21 match = _VERSION_PATTERN.match(version)
22 if not match:
23 raise ValueError(
24 f"Invalid version string '{version}'. "
25 f"Expected 'latest', 'vN', or 'versionN' (e.g. 'v2', 'version3')."
26 )
27 return False, int(match.group(1))
28
29
30def normalize_version_string(version: str) -> str:

Callers 15

apply_feature_viewMethod · 0.90
apply_feature_viewMethod · 0.90
test_latest_stringMethod · 0.90
test_empty_stringMethod · 0.90
test_v_formatMethod · 0.90
test_version_formatMethod · 0.90
test_v0Method · 0.90
test_invalid_formatMethod · 0.90

Calls

no outgoing calls

Tested by 11

test_latest_stringMethod · 0.72
test_empty_stringMethod · 0.72
test_v_formatMethod · 0.72
test_version_formatMethod · 0.72
test_v0Method · 0.72
test_invalid_formatMethod · 0.72