1 |
commit: 94201ef142659bd4baec08e30bc2c7c3dd1b8683 |
2 |
Author: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de> |
3 |
AuthorDate: Mon Jan 27 23:03:45 2014 +0000 |
4 |
Commit: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de > |
5 |
CommitDate: Wed Feb 5 19:39:21 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94201ef1 |
7 |
|
8 |
Add digraph.discard |
9 |
|
10 |
--- |
11 |
pym/portage/util/digraph.py | 12 +++++++++++- |
12 |
1 file changed, 11 insertions(+), 1 deletion(-) |
13 |
|
14 |
diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py |
15 |
index fc1fb86..4a9cb43 100644 |
16 |
--- a/pym/portage/util/digraph.py |
17 |
+++ b/pym/portage/util/digraph.py |
18 |
@@ -1,4 +1,4 @@ |
19 |
-# Copyright 2010-2013 Gentoo Foundation |
20 |
+# Copyright 2010-2014 Gentoo Foundation |
21 |
# Distributed under the terms of the GNU General Public License v2 |
22 |
|
23 |
from __future__ import unicode_literals |
24 |
@@ -47,6 +47,16 @@ class digraph(object): |
25 |
priorities.append(priority) |
26 |
priorities.sort() |
27 |
|
28 |
+ def discard(self, node): |
29 |
+ """ |
30 |
+ Like remove(), except it doesn't raises KeyError if the |
31 |
+ node doesn't exist. |
32 |
+ """ |
33 |
+ try: |
34 |
+ self.remove(node) |
35 |
+ except KeyError: |
36 |
+ pass |
37 |
+ |
38 |
def remove(self, node): |
39 |
"""Removes the specified node from the digraph, also removing |
40 |
and ties to other nodes in the digraph. Raises KeyError if the |