INNER CODE UNIT · Python
write
labsai/EDDI · scripts/bump-version.py:94
def write(path: Path, text: str) -> None:
with path.open("w", encoding="utf-8", newline="") as f:
f.write(text)
def lines_of(text: str) -> list[str]:
"""Lines split on "\\n" only, each keeping its terminator. str.splitlines()
also splits on form feeds and other separators Java's String.lines() does
not, which would number lines differently from ReleaseVersionSourceTest."""
return re.split(r"(?<=\n)", text)
class Repo:
def __init__(self, root: Path):
self.root = root
cfg = json.loads(read(root / POINTERS))
self.roots = cfg["roots"]
self.extensions = tuple(cfg["extensions"])