summaryrefslogtreecommitdiffstats
path: root/pym/portage/cache/volatile.py
blob: a3c57f55f1fcff33d31d63b3e2fdd6df04d258cb (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

import copy
from portage.cache import template

class database(template.database):

	autocommits = True
	serialize_eclasses = False
	store_eclass_paths = False

	def __init__(self, *args, **config):
		config.pop("gid", None)
		config.pop("perms", None)
		super(database, self).__init__(*args, **config)
		self._data = {}
		self._delitem = self._data.__delitem__

	def __setitem__(self, name, values):
		self._data[name] = copy.deepcopy(values)

	def __getitem__(self, cpv):
		return copy.deepcopy(self._data[cpv])

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

	def __contains__(self, key):
		return key in self._data