Beispiel #1
0
 def generate(self, dot_code, model_type, renderer = 'dot'):
   if not dot_code:
     dot_code = ''
   fd, temp_abspath = make_tempfile(suffix=self.extension)
   temp_file = open(temp_abspath, 'wb')
   temp_file.write(dot_code)
   temp_file.close()
   os.close(fd)
   output = cmd([renderer, '-Tsvg', temp_abspath])
   os.remove(temp_abspath)
   output = self.process_output(str(output), model_type)
   return output
Beispiel #2
0
 def generate(self, dot_code, model_type, renderer='dot'):
     if not dot_code:
         dot_code = ''
     fd, temp_abspath = make_tempfile(suffix=self.extension)
     temp_file = open(temp_abspath, 'w')
     temp_file.write(dot_code)
     temp_file.close()
     os.close(fd)
     output = cmd([renderer, '-Tsvg', temp_abspath]).decode('utf-8')
     os.remove(temp_abspath)
     output = self.process_output(str(output), model_type)
     return output