def render()

in lib/litani_report.py [0:0]


    def render(self, gnu_file, out_file=None):
        if not self.should_render():
            raise UserWarning(
                "Should not call Gnuplot.render() if should_render() is False")

        cmd = ["gnuplot"]
        with subprocess.Popen(
                cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                stderr=subprocess.DEVNULL, text=True) as proc:
            out, _ = proc.communicate(input=gnu_file)
        if proc.returncode:
            logging.error("Failed to render gnuplot file:")
            logging.error(gnu_file)
            self._should_render = False
            return

        lines = [
            l for l in out.splitlines()
            if "<?xml version" not in l
        ]
        if out_file:
            with litani.atomic_write(out_file) as handle:
                print("\n".join(lines), file=handle)
        return lines