INNER CODE UNIT · Python
parse
labsai/EDDI · scripts/bump-version.py:67
def parse(version: str) -> tuple[int, int, int]:
"""A release version: exactly MAJOR.MINOR.PATCH."""
m = SEMVER.match(version)
if not m:
raise BumpError(f"'{version}' is not MAJOR.MINOR.PATCH (release tags carry no 'v' and no suffix)")
return int(m.group(1)), int(m.group(2)), int(m.group(3))
def core(version: str, what: str) -> tuple[int, int, int]:
"""The numeric core of a version that may carry a suffix, such as the pom's."""
m = SEMVER_CORE.match(version)
if not m:
raise BumpError(f"{what} is '{version}', which does not start with MAJOR.MINOR.PATCH; "
"refusing to compare against it")
return int(m.group(1)), int(m.group(2)), int(m.group(3))
def fmt(v: tuple[int, int, int]) -> str: