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 1Qhf54-0007gv-VD for garchives@archives.gentoo.org; Fri, 15 Jul 2011 09:53:11 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A8EE221C13A; Fri, 15 Jul 2011 09:52:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 753D321C141 for ; Fri, 15 Jul 2011 09:52:28 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CFE682AC321 for ; Fri, 15 Jul 2011 09:52:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D60ED8004C for ; Fri, 15 Jul 2011 09:52:26 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/basepm/ X-VCS-Repository: proj/gentoopm X-VCS-Files: gentoopm/basepm/repo.py X-VCS-Directories: gentoopm/basepm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: e5b7f5d96ba1fccee89144118bea092572111a0f Date: Fri, 15 Jul 2011 09:52:26 +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: 68ccbb734bad16b550250b0cd915336b commit: e5b7f5d96ba1fccee89144118bea092572111a0f Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Fri Jul 15 09:06:12 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Fri Jul 15 09:06:12 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoopm.git;= a=3Dcommit;h=3De5b7f5d9 Support checking repo existence using 'in'. --- gentoopm/basepm/repo.py | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/gentoopm/basepm/repo.py b/gentoopm/basepm/repo.py index 87b9c3d..721804d 100644 --- a/gentoopm/basepm/repo.py +++ b/gentoopm/basepm/repo.py @@ -44,6 +44,14 @@ class PMRepositoryDict(ABCObject): return r raise KeyError('No repository matched key %s' % key) =20 + def __contains__(self, k): + try: + self[k] + except KeyError: + return False + else: + return True + @abstractmethod def __iter__(self): """