summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/Task.py
blob: 4dbdb11854f0cfa95210b117c1551c0a7dde1596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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 __eq__(self, other):
		return self._hash_key == other

	def __ne__(self, other):
		return self._hash_key != other

	def __hash__(self):
		return self._hash_value

	def __len__(self):
		return len(self._hash_key)

	def __getitem__(self, key):
		return self._hash_key[key]

	def __iter__(self):
		return iter(self._hash_key)

	def __contains__(self, 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._hash_key))