INNER CODE UNIT · Python

bytes

pineforge-4pass/pineforge-engine · benchmarks/check_provenance.py:88

    def bytes(self, path: str) -> bytes:
        self.reads.append(path)
        if path not in self._read:
            if self.rev:
                res = self._git("show", f"{self.rev}:{path}", text=False)
                if res.returncode:
                    raise Unsourced(f"{path} is not committed at {self.rev}")
                self._read[path] = res.stdout
            elif self._git("ls-files", "--error-unmatch", path).returncode or not (REPO / path).is_file():
                raise Unsourced(f"{path} is not committed")
            else:
                self._read[path] = (REPO / path).read_bytes()
        return self._read[path]

    def text(self, path: str) -> str:
        return self.bytes(path).decode("utf-8")

    def json(self, path: str):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…