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 1QNJ8N-00086Q-As for garchives@archives.gentoo.org; Fri, 20 May 2011 06:24:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AA19E1C044; Fri, 20 May 2011 06:24:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 656201C044 for ; Fri, 20 May 2011 06:24:19 +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 CDBB21B404A for ; Fri, 20 May 2011 06:24:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 0B64D8001E for ; Fri, 20 May 2011 06:24:18 +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:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/Blocker.py pym/_emerge/Package.py pym/_emerge/Task.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: d217a5112378a7eaf2b5d1fa04600b3da409bbee Date: Fri, 20 May 2011 06:24:18 +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: 330334f27ff29cfeabcffc5a2e44e3ab commit: d217a5112378a7eaf2b5d1fa04600b3da409bbee Author: Zac Medico gentoo org> AuthorDate: Fri May 20 06:23:51 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri May 20 06:23:51 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dd217a511 Task: remove unnecessary _get_hash_key() method --- pym/_emerge/Blocker.py | 11 ++--------- pym/_emerge/Package.py | 5 +---- pym/_emerge/Task.py | 24 +++++++++--------------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/pym/_emerge/Blocker.py b/pym/_emerge/Blocker.py index 5c335b0..4f61c88 100644 --- a/pym/_emerge/Blocker.py +++ b/pym/_emerge/Blocker.py @@ -1,4 +1,4 @@ -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 from _emerge.Task import Task @@ -11,11 +11,4 @@ class Blocker(Task): def __init__(self, **kwargs): Task.__init__(self, **kwargs) self.cp =3D self.atom.cp - - def _get_hash_key(self): - hash_key =3D getattr(self, "_hash_key", None) - if hash_key is None: - self._hash_key =3D \ - ("blocks", self.root, self.atom, self.eapi) - return self._hash_key - + self._hash_key =3D ("blocks", self.root, self.atom, self.eapi) diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 12fa537..067d628 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -460,9 +460,6 @@ class Package(Task): missing_iuse.append(flag) return missing_iuse =20 - def _get_hash_key(self): - return self._hash_key - def __len__(self): return 4 =20 @@ -471,7 +468,7 @@ class Package(Task): This is used to generate mtimedb resume mergelist entries, so we limit it to 4 items for backward compatibility. """ - return iter(self._get_hash_key()[:4]) + return iter(self._hash_key[:4]) =20 def __lt__(self, other): if other.cp !=3D self.cp: diff --git a/pym/_emerge/Task.py b/pym/_emerge/Task.py index 31788b5..3dd1193 100644 --- a/pym/_emerge/Task.py +++ b/pym/_emerge/Task.py @@ -1,43 +1,37 @@ -# Copyright 1999-2009 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 from _emerge.SlotObject import SlotObject class Task(SlotObject): __slots__ =3D ("_hash_key", "_hash_value") =20 - def _get_hash_key(self): - try: - return self._hash_key - except AttributeError: - raise NotImplementedError(self) - def __eq__(self, other): - return self._get_hash_key() =3D=3D other + return self._hash_key =3D=3D other =20 def __ne__(self, other): - return self._get_hash_key() !=3D other + return self._hash_key !=3D other =20 def __hash__(self): hash_value =3D getattr(self, "_hash_value", None) if hash_value is None: - self._hash_value =3D hash(self._get_hash_key()) + self._hash_value =3D hash(self._hash_key) return self._hash_value =20 def __len__(self): - return len(self._get_hash_key()) + return len(self._hash_key) =20 def __getitem__(self, key): - return self._get_hash_key()[key] + return self._hash_key[key] =20 def __iter__(self): - return iter(self._get_hash_key()) + return iter(self._hash_key) =20 def __contains__(self, key): - return key in self._get_hash_key() + return key in self._hash_key =20 def __str__(self): """ Emulate tuple.__repr__, but don't show 'foo' as u'foo' for unicode strings. """ - return "(%s)" % ", ".join(("'%s'" % x for x in self._get_hash_key())) + return "(%s)" % ", ".join(("'%s'" % x for x in self._hash_key))