INNER CODE UNIT · Python

debug

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

    def debug(self, flag):
        """t.debug(flag) turns debugging on or off."""
        self.debugging = flag

    def append(self, cmd, kind):
        """t.append(cmd, kind) adds a new step at the end."""
        if not isinstance(cmd, str):
            raise TypeError("Template.append: cmd must be a string")
        if kind not in stepkinds:
            raise ValueError("Template.append: bad kind %r" % (kind,))
        if kind == SOURCE:
            raise ValueError("Template.append: SOURCE can only be prepended")
        if self.steps and self.steps[-1][1] == SINK:
            raise ValueError("Template.append: already ends with SINK")
        if kind[0] == "f" and not re.search(r"\$IN\b", cmd):
            raise ValueError("Template.append: missing $IN in cmd")
        if kind[1] == "f" and not re.search(r"\$OUT\b", cmd):
            raise ValueError("Template.append: missing $OUT in cmd")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…