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

Function replace_poetry_version

scripts/scripts/bump-version.py:70–78  ·  view source on GitHub ↗
(toml: str, new_version: str)

Source from the content-addressed store, hash-verified

68
69
70def replace_poetry_version(toml: str, new_version: str) -> tuple[str, bool]:
71 pattern = re.compile(
72 r'(\n\[tool\.poetry\][\s\S]*?\n)(version\s*=\s*\")([^\"]+)(\"\s*)(\n)',
73 re.MULTILINE,
74 )
75 def _repl(m: re.Match) -> str:
76 return f"{m.group(1)}{m.group(2)}{new_version}{m.group(4)}{m.group(5)}"
77 new_toml, n = pattern.subn(_repl, toml, count=1)
78 return new_toml, n > 0
79
80
81def replace_workspace_package_version(toml: str, new_version: str) -> tuple[str, bool]:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected