public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/_emerge/
Date: Thu, 26 May 2011 06:18:33 +0000 (UTC)	[thread overview]
Message-ID: <164647b7fa04e80f3018070c2d029b22d60cb02f.zmedico@gentoo> (raw)

commit:     164647b7fa04e80f3018070c2d029b22d60cb02f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri May 20 06:23:51 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:30:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=164647b7

Task: remove unnecessary _get_hash_key() method

---
 pym/_emerge/Blocker.py |   11 ++---------
 pym/_emerge/Package.py |    3 ---
 pym/_emerge/Task.py    |   24 +++++++++---------------
 3 files changed, 11 insertions(+), 27 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
 
 from _emerge.Task import Task
@@ -11,11 +11,4 @@ class Blocker(Task):
 	def __init__(self, **kwargs):
 		Task.__init__(self, **kwargs)
 		self.cp = self.atom.cp
-
-	def _get_hash_key(self):
-		hash_key = getattr(self, "_hash_key", None)
-		if hash_key is None:
-			self._hash_key = \
-				("blocks", self.root, self.atom, self.eapi)
-		return self._hash_key
-
+		self._hash_key = ("blocks", self.root, self.atom, self.eapi)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index d7efbf2..3f76c0e 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -407,9 +407,6 @@ class Package(Task):
 					missing_iuse.append(flag)
 			return missing_iuse
 
-	def _get_hash_key(self):
-		return self._hash_key
-
 	def __lt__(self, other):
 		if other.cp != self.cp:
 			return False

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
 
 from _emerge.SlotObject import SlotObject
 class Task(SlotObject):
 	__slots__ = ("_hash_key", "_hash_value")
 
-	def _get_hash_key(self):
-		try:
-			return self._hash_key
-		except AttributeError:
-			raise NotImplementedError(self)
-
 	def __eq__(self, other):
-		return self._get_hash_key() == other
+		return self._hash_key == other
 
 	def __ne__(self, other):
-		return self._get_hash_key() != other
+		return self._hash_key != other
 
 	def __hash__(self):
 		hash_value = getattr(self, "_hash_value", None)
 		if hash_value is None:
-			self._hash_value = hash(self._get_hash_key())
+			self._hash_value = hash(self._hash_key)
 		return self._hash_value
 
 	def __len__(self):
-		return len(self._get_hash_key())
+		return len(self._hash_key)
 
 	def __getitem__(self, key):
-		return self._get_hash_key()[key]
+		return self._hash_key[key]
 
 	def __iter__(self):
-		return iter(self._get_hash_key())
+		return iter(self._hash_key)
 
 	def __contains__(self, key):
-		return key in self._get_hash_key()
+		return key in self._hash_key
 
 	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))



             reply	other threads:[~2011-05-26  6:23 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26  6:18 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-27  3:36 [gentoo-commits] proj/portage:2.1.9 commit in: pym/_emerge/ Zac Medico
2011-05-27  1:26 Zac Medico
2011-05-27  0:40 Zac Medico
2011-05-26 22:34 Zac Medico
2011-05-26 21:37 Zac Medico
2011-05-26 13:04 Zac Medico
2011-05-26 12:52 Zac Medico
2011-05-26 12:26 Zac Medico
2011-05-26 12:05 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-05 18:12 Zac Medico
2011-05-05 16:01 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-01 21:54 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-02-22 17:41 Zac Medico
2011-02-22  3:16 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-14 17:02 Zac Medico
2011-02-14 16:45 Zac Medico
2011-02-14 16:35 Zac Medico
2011-02-14 16:04 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  5:04 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-08 20:48 Zac Medico
2011-02-05  3:37 Zac Medico
2011-02-04 17:47 zmedico
2011-02-04 15:57 zmedico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164647b7fa04e80f3018070c2d029b22d60cb02f.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox