summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-19 23:31:55 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-19 23:31:55 -0700
commitbd479b8600af2b972969784f19fe124ff528b6f8 (patch)
treed243fb7080055039f15078ce0bb3baba7e4ac864
parentd217a5112378a7eaf2b5d1fa04600b3da409bbee (diff)
downloadportage-bd479b8600af2b972969784f19fe124ff528b6f8.tar.gz
portage-bd479b8600af2b972969784f19fe124ff528b6f8.tar.bz2
portage-bd479b8600af2b972969784f19fe124ff528b6f8.zip
Task: precalculate _hash_value
-rw-r--r--pym/_emerge/Blocker.py1
-rw-r--r--pym/_emerge/Package.py1
-rw-r--r--pym/_emerge/Task.py3
3 files changed, 2 insertions, 3 deletions
diff --git a/pym/_emerge/Blocker.py b/pym/_emerge/Blocker.py
index 4f61c887d..93046069d 100644
--- a/pym/_emerge/Blocker.py
+++ b/pym/_emerge/Blocker.py
@@ -12,3 +12,4 @@ class Blocker(Task):
Task.__init__(self, **kwargs)
self.cp = self.atom.cp
self._hash_key = ("blocks", self.root, self.atom, self.eapi)
+ self._hash_value = hash(self._hash_key)
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 067d628ca..6847a3240 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -89,6 +89,7 @@ class Package(Task):
repo_key = self.type_name
self._hash_key = \
(self.type_name, self.root, self.cpv, self.operation, repo_key)
+ self._hash_value = hash(self._hash_key)
def _validate_deps(self):
"""
diff --git a/pym/_emerge/Task.py b/pym/_emerge/Task.py
index 3dd119304..4dbdb1185 100644
--- a/pym/_emerge/Task.py
+++ b/pym/_emerge/Task.py
@@ -12,9 +12,6 @@ class Task(SlotObject):
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._hash_key)
return self._hash_value
def __len__(self):