From bd479b8600af2b972969784f19fe124ff528b6f8 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 19 May 2011 23:31:55 -0700 Subject: [PATCH] Task: precalculate _hash_value --- pym/_emerge/Blocker.py | 1 + pym/_emerge/Package.py | 1 + pym/_emerge/Task.py | 3 --- 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): -- 2.26.2