INNER CODE UNIT · Python

open_r

theyosh/TerrariumPI · contrib/pipes/__init__.py:160

    def open_r(self, file):
        """t.open_r(file) and t.open_w(file) implement
        t.open(file, 'r') and t.open(file, 'w') respectively."""
        if not self.steps:
            return open(file, "r")
        if self.steps[-1][1] == SINK:
            raise ValueError("Template.open_r: pipeline ends width SINK")
        cmd = self.makepipeline(file, "")
        return os.popen(cmd, "r")

    def open_w(self, file):
        if not self.steps:
            return open(file, "w")
        if self.steps[0][1] == SOURCE:
            raise ValueError("Template.open_w: pipeline begins with SOURCE")
        cmd = self.makepipeline("", file)
        return os.popen(cmd, "w")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…