class_docstr: Execute the given python file and puts its result in the document.
class_docstr_tok: ["Execute","the","given","python","file","and","puts","its","result","in","the","document","."]
code: def run(self):
      width, height = (
          map(int, self.arguments[:2])
          if len(self.arguments) >= 2
          else (600, 400)
      )
      if len(self.arguments) == 1:
          self.render_fix = bool(self.arguments[0])
      elif len(self.arguments) == 3:
          self.render_fix = bool(self.arguments[2])
      else:
          self.render_fix = False
      self.content = list(self.content)
      content = list(self.content)
      if self.render_fix:
          content[-1] = "rv = " + content[-1]
      code = "\n".join(content)
      scope = {"pygal": pygal}
      try:
          exec(code, scope)
      except Exception:
          print(code)
          print_exc()
          return [
              docutils.nodes.system_message(
                  "An exception as occured during code parsing:"
                  " \n %s" % format_exc(),
                  type="ERROR",
                  source="/",
                  level=3,
              )
          ]
      if self.render_fix:
          _rv = scope["rv"]
      else:
          chart = None
          for key, value in scope.items():
              if isinstance(value, pygal.graph.graph.Graph):
                  chart = value
                  self.content.append(key + ".render()")
                  break
          if chart is None:
              return [
                  docutils.nodes.system_message(
                      "No instance of graph found",
                      level=3,
                      type="ERROR",
                      source="/",
                  )
              ]
          chart.config.width = width
          chart.config.height = height
          chart.explicit_size = True
  
      try:
          svg = '<embed src="%s" />' % chart.render_data_uri()
      except Exception:
          return [
              docutils.nodes.system_message(
                  "An exception as occured during graph generation:"
                  " \n %s" % format_exc(),
                  type="ERROR",
                  source="/",
                  level=3,
              )
          ]
      return [docutils.nodes.raw("", svg, format="html")]
  
file_path: pygal/docs/ext/pygal_sphinx_directives.py
imports: from traceback import format_exc, print_exc
  import docutils.core
  from docutils.parsers.rst import Directive
  from sphinx.directives.code import CodeBlock
  import pygal
label_desc: Use image node_id 1 for calling the PygalDirective obj's underlying member method code with example usage: obj.run() and returns: list, list, list, list