INNER CODE UNIT · Python

fmt

labsai/EDDI · scripts/bump-version.py:84

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()


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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…