diff options
Diffstat (limited to 'pym/portage/__init__.py')
-rw-r--r-- | pym/portage/__init__.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index bd32623a0..1a75bac16 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -389,6 +389,26 @@ class digraph(object): del self.nodes[node] self.order.remove(node) + def difference_update(self, t): + """ + Remove all given nodes from node_set. This is more efficient + than multiple calls to the remove() method. + """ + if isinstance(t, (list, tuple)) or \ + not hasattr(t, "__contains__"): + t = frozenset(t) + order = [] + for node in self.order: + if node not in t: + order.append(node) + continue + for parent in self.nodes[node][1]: + del self.nodes[parent][0][node] + for child in self.nodes[node][0]: + del self.nodes[child][1][node] + del self.nodes[node] + self.order = order + def remove_edge(self, child, parent): """ Remove edge in the direction from child to parent. Note that it is |