class_docstr: Reorder top-level functions to prevent circular type dependencies.  
docstr: Format type dependencies information to use if for reordering. 
code: def prepare(self, node):
      """Format type dependencies information to use if for reordering."""
      super(Reorder, self).prepare(node)
      candidates = self.type_dependencies.successors(
          TypeDependencies.NoDeps
      )
      # We first select function which may have a result without calling any
      # others functions.
      # Then we check if no loops type dependencies exists. If it exists, we
      # can safely remove the dependency as it could be compute without this
      # information.
      # As we can compute type for this function, successors can potentially
      # be computed
      # FIXME: This is false in some cases
      #
      # def bar(i):
      #   if i > 0:
      #     return foo(i)
      #   else:
      #     return []
      #
      # def foo(i):
      #   return [len(bar(i-1)) + len(bar(i - 2))]
      #
      # If we check for function without deps first, we will pick bar and say
      # it returns empty list
      while candidates:
          new_candidates = list()
          for n in candidates:
              # remove edges that imply a circular dependency
              for p in list(self.type_dependencies.predecessors(n)):
                  if graph.has_path(self.type_dependencies, n, p):
                      self.type_dependencies.remove_edge(p, n)
              if n not in self.type_dependencies.successors(n):
                  new_candidates.extend(
                      self.type_dependencies.successors(n)
                  )
          candidates = new_candidates
  
file_path: pythran/pythran/types/reorder.py
imports: import gast
  from pythran.analyses import OrderedGlobalDeclarations
  from pythran.passmanager import Transformation
  from pythran.syntax import PythranSyntaxError
  from pythran.types.type_dependencies import TypeDependencies
  import pythran.graph
label_desc: Use image node_id 2 for calling the Reorder obj's underlying member method code with example usage: obj.prepare(node) without return types