MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / bump_part

Function bump_part

scripts/scripts/bump-version.py:44–55  ·  view source on GitHub ↗
(v: str, part: str)

Source from the content-addressed store, hash-verified

42
43
44def bump_part(v: str, part: str) -> str:
45 m = SEMVER_RE.match(v)
46 if not m:
47 raise ValueError(f"Not a semver: {v}")
48 major, minor, patch = map(int, m.groups())
49 if part == "major":
50 return f"{major+1}.0.0"
51 if part == "minor":
52 return f"{major}.{minor+1}.0"
53 if part == "patch":
54 return f"{major}.{minor}.{patch+1}"
55 raise ValueError(part)
56
57
58def replace_version_in_project_section(toml: str, new_version: str) -> tuple[str, bool]:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected