INNER CODE UNIT · Python
core
labsai/EDDI · scripts/bump-version.py:75
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:
return ".".join(str(p) for p in v)
def read(path: Path) -> str:
# newline="" keeps CRLF as CRLF, so a rewrite changes only the version.
with path.open(encoding="utf-8", newline="") as f:
return f.read()