Ejemplo n.º 1
0
 def order_components(self):
     components_byname = {component.name: component
         for component in self.component_plugins}
     
     G_prefilter = {name: component.component_dependencies
         for name, component in components_byname.iteritems()}
     
     G_postfilter = {}
     for name, deps in G_prefilter.iteritems():
         # FIXME: log warning [that's why this isn't a dict comprehension]
         if any(dep not in components_byname for dep in deps):
             continue
         G_postfilter[name] = deps
     
     self.component_plugins = [components_byname[name]
         for name in utils.topsort(G_postfilter)]
Ejemplo n.º 2
0
 def test_manycycle(self):
     with self.assertRaises(utils.CircularDependencyError):
         list(utils.topsort({0: [], 1: [0], 2: [3], 3: [2]}))
Ejemplo n.º 3
0
 def test_many(self):
     self.assertEqual(
         list(utils.topsort({0: [], 1: [0], 2: [1], 3: [1, 2]})),
         [0, 1, 2, 3])
Ejemplo n.º 4
0
 def test_singlecycle(self):
     with self.assertRaises(utils.CircularDependencyError):
         list(utils.topsort({1: [1]}))
Ejemplo n.º 5
0
 def test_single(self):
     self.assertEqual(
         list(utils.topsort({1: []})),
         [1])
Ejemplo n.º 6
0
 def test_empty(self):
     self.assertEqual(
         list(utils.topsort({})),
         [])
Ejemplo n.º 7
0
 def init_postprocessors(self):
     postprocessors = self.engine.plugins.produce_instances(
         MutatingPostProcessingPlugin)
     self.postprocessors = list(utils.topsort(
         {p: p.processing_dependencies
         for p in postprocessors}))