def run(self):
        source = self.state_machine.input_lines.source(self.lineno - self.state_machine.input_offset - 1)
        source_dir = os.path.dirname(os.path.abspath(source))
        path = directives.path(self.arguments[0])
        path = os.path.normpath(os.path.join(source_dir, path))
        
        path = utils.relative_path(None, path)
        path = nodes.reprunicode(path)
        img_folder = None
        img_folder_os = None
        if "image_folder" in self.options:
            # This is extremly messy.. 
            # To be able to test if file exist in path we need to use img_path_os
            # But that cannot be used for the .. image:: tag, instead we need to use the raw option!
            img_folder_os = os.path.normpath(os.path.join(source_dir, self.options["image_folder"]))
            img_folder = self.options["image_folder"]
        rawtext = parse_examples(path, img_folder, img_folder_os)

        include_lines = statemachine.string2lines(rawtext, self.state.document.settings.tab_width,
                                                  convert_whitespace=True)
        
        self.state_machine.insert_input(include_lines, path)
        return []
dataset/ETHPy150Open estevaofon/angry-birds-python/pymunk-4.0.0/docs/src/ext/autoexample.py/AutoExampleDirective.run/original