Ejemplo n.º 1
0
 def buildflowgraph(self, func, mute_dot=False):
     """Get the flow graph for a function."""
     if not isinstance(func, types.FunctionType):
         raise TypeError("buildflowgraph() expects a function, " "got %r" % (func,))
     if func in self._prebuilt_graphs:
         graph = self._prebuilt_graphs.pop(func)
     else:
         if self.config.translation.verbose:
             log(nice_repr_for_func(func))
         graph = build_flow(func)
         simplify.simplify_graph(graph)
         if self.config.translation.list_comprehension_operations:
             simplify.detect_list_comprehension(graph)
         if not self.config.translation.verbose and not mute_dot:
             log.dot()
         self.graphs.append(graph)  # store the graph in our list
     return graph
Ejemplo n.º 2
0
 def buildflowgraph(self, func, mute_dot=False):
     """Get the flow graph for a function."""
     if not isinstance(func, types.FunctionType):
         raise TypeError("buildflowgraph() expects a function, "
                         "got %r" % (func, ))
     if func in self._prebuilt_graphs:
         graph = self._prebuilt_graphs.pop(func)
     else:
         if self.config.translation.verbose:
             log(nice_repr_for_func(func))
         graph = build_flow(func)
         simplify.simplify_graph(graph)
         if self.config.translation.list_comprehension_operations:
             simplify.detect_list_comprehension(graph)
         if not self.config.translation.verbose and not mute_dot:
             log.dot()
         self.graphs.append(graph)  # store the graph in our list
     return graph