INNER CODE UNIT · Python

swap

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

        def swap(m: re.Match) -> str:
            whole = m.group(0)
            return whole[: m.start(1) - m.start(0)] + version + whole[m.end(1) - m.start(0):]

        for path in self.pointer_files():
            out = []
            # Line by line, exactly as pointers() and the Java sweep match, so a
            # pattern means the same thing to the check and to the rewrite.
            for line in lines_of(read(path)):
                body = line.rstrip("\r\n")
                ending = line[len(body):]
                for pattern in self.patterns:
                    body = pattern.sub(swap, body)
                out.append(body + ending)
            self._rewrite(path, "".join(out))

    def set_chart_version(self, version: str) -> None:
        path = self.root / CHART

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…