From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 665E21380DC for ; Wed, 5 Feb 2014 19:42:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 290ECE0CBA; Wed, 5 Feb 2014 19:42:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 95772E0CBA for ; Wed, 5 Feb 2014 19:42:14 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9DFC033F947 for ; Wed, 5 Feb 2014 19:42:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 0DA991888A for ; Wed, 5 Feb 2014 19:42:10 +0000 (UTC) From: "Sebastian Luther" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sebastian Luther" Message-ID: <1391629161.94201ef142659bd4baec08e30bc2c7c3dd1b8683.few@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/digraph.py X-VCS-Directories: pym/portage/util/ X-VCS-Committer: few X-VCS-Committer-Name: Sebastian Luther X-VCS-Revision: 94201ef142659bd4baec08e30bc2c7c3dd1b8683 X-VCS-Branch: master Date: Wed, 5 Feb 2014 19:42:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 40f45f9f-8e6d-4d96-a050-2a4d43301e53 X-Archives-Hash: 41e75acc5e72dca51d432c7d5f83161d commit: 94201ef142659bd4baec08e30bc2c7c3dd1b8683 Author: Sebastian Luther gmx de> AuthorDate: Mon Jan 27 23:03:45 2014 +0000 Commit: Sebastian Luther gmx de > CommitDate: Wed Feb 5 19:39:21 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94201ef1 Add digraph.discard --- pym/portage/util/digraph.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py index fc1fb86..4a9cb43 100644 --- a/pym/portage/util/digraph.py +++ b/pym/portage/util/digraph.py @@ -1,4 +1,4 @@ -# Copyright 2010-2013 Gentoo Foundation +# Copyright 2010-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -47,6 +47,16 @@ class digraph(object): priorities.append(priority) priorities.sort() + def discard(self, node): + """ + Like remove(), except it doesn't raises KeyError if the + node doesn't exist. + """ + try: + self.remove(node) + except KeyError: + pass + def remove(self, node): """Removes the specified node from the digraph, also removing and ties to other nodes in the digraph. Raises KeyError if the