-# 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
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)
missing_iuse.append(flag)
return missing_iuse
- def _get_hash_key(self):
- return self._hash_key
-
def __len__(self):
return 4
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])
def __lt__(self, other):
if other.cp != self.cp:
-# 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))