From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QPU0o-0004JY-Ri for garchives@archives.gentoo.org; Thu, 26 May 2011 06:25:39 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3979B1C4F2; Thu, 26 May 2011 06:18:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0BE9A1C4F2 for ; Thu, 26 May 2011 06:18:31 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D04B11B400D for ; Thu, 26 May 2011 06:18:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 3DC718050C for ; Thu, 26 May 2011 06:18:31 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:2.1.9 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: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: b4e3696832da26b5394867f239694ea133272faf Date: Thu, 26 May 2011 06:18:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 22fe3bed154d074809bc8c89e3934ee7 commit: b4e3696832da26b5394867f239694ea133272faf Author: Zac Medico gentoo org> AuthorDate: Wed May 18 01:43:32 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu May 26 03:11:27 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Db4e36968 digraph: implement __bool__ --- pym/portage/util/digraph.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py index df024fb..1bbe10f 100644 --- a/pym/portage/util/digraph.py +++ b/pym/portage/util/digraph.py @@ -1,9 +1,11 @@ -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 __all__ =3D ['digraph'] =20 from collections import deque +import sys + from portage import _unicode_decode from portage.util import writemsg =20 @@ -221,6 +223,9 @@ class digraph(object): root_nodes.append(node) return root_nodes =20 + def __bool__(self): + return bool(self.nodes) + def is_empty(self): """Checks if the digraph is empty""" return len(self.nodes) =3D=3D 0 @@ -332,3 +337,6 @@ class digraph(object): __contains__ =3D contains empty =3D is_empty copy =3D clone + + if sys.hexversion < 0x3000000: + __nonzero__ =3D __bool__