Add an ignore_priority parameter to digraph.parent_nodes(). (trunk r12551)
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:24:21 +0000 (03:24 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:24:21 +0000 (03:24 -0000)
svn path=/main/branches/2.1.6/; revision=12837

pym/portage/__init__.py

index 406f15d2770d1d309fc6201832a58a4483d098cf..27ba5efbdf45ff4f2d1e35450930ddf5a280216b 100644 (file)
@@ -459,16 +459,22 @@ class digraph(object):
        def child_nodes(self, node, ignore_priority=None):
                """Return all children of the specified node"""
                if ignore_priority is None:
-                       return self.nodes[node][0].keys()
+                       return list(self.nodes[node][0])
                children = []
                for child, priority in self.nodes[node][0].iteritems():
                        if priority > ignore_priority:
                                children.append(child)
                return children
 
-       def parent_nodes(self, node):
+       def parent_nodes(self, node, ignore_priority=None):
                """Return all parents of the specified node"""
-               return self.nodes[node][1].keys()
+               if ignore_priority is None:
+                       return list(self.nodes[node][1])
+               parents = []
+               for parent, priority in self.nodes[node][1].iteritems():
+                       if priority > ignore_priority:
+                               parents.append(parent)
+               return parents
 
        def leaf_nodes(self, ignore_priority=None):
                """Return all nodes that have no children