INNER CODE UNIT · Python

lines_of

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

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"])
        self.exclude = cfg["exclude"]
        # ASCII, so \d and \w mean what they mean in Java's regex.
        self.patterns = [re.compile(p, re.ASCII) for p in cfg["patterns"]]
        self.changed: list[str] = []

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…