portage.cache.mappings module

class portage.cache.mappings.LazyLoad(pull_items_func, initial_items=[])

Bases: portage.cache.mappings.Mapping

Lazy loading of values for a dict

d
get(key, default=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
pull
values()
class portage.cache.mappings.Mapping

Bases: object

In python-3.0, the UserDict.DictMixin class has been replaced by Mapping and MutableMapping from the collections module, but 2to3 doesn’t currently account for this change:

As a workaround for the above issue, use this class as a substitute for UserDict.DictMixin so that code converted via 2to3 will run.

get(key, default=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
values()
class portage.cache.mappings.MutableMapping

Bases: portage.cache.mappings.Mapping

A mutable vesion of the Mapping class.

clear()
get(key, default=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
pop(key, *args)
popitem()
setdefault(key, default=None)
update(*args, **kwargs)
values()
class portage.cache.mappings.ProtectedDict(orig)

Bases: portage.cache.mappings.MutableMapping

given an initial dict, this wraps that dict storing changes in a secondary dict, protecting the underlying dict from changes

blacklist
clear()
get(key, default=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
new
orig
pop(key, *args)
popitem()
setdefault(key, default=None)
update(*args, **kwargs)
values()
class portage.cache.mappings.UserDict(*args, **kwargs)

Bases: portage.cache.mappings.MutableMapping

Use this class as a substitute for UserDict.UserDict so that code converted via 2to3 will run:

clear()
data
get(key, default=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
pop(key, *args)
popitem()
setdefault(key, default=None)
update(*args, **kwargs)
values()
portage.cache.mappings.slot_dict_class(keys, prefix='_val_')

Generates mapping classes that behave similar to a dict but store values as object attributes that are allocated via __slots__. Instances of these objects have a smaller memory footprint than a normal dict object.

Parameters
  • keys (Iterable) – Fixed set of allowed keys

  • prefix (String) – a prefix to use when mapping attribute names from keys

Return type

SlotDict

Returns

A class that constructs SlotDict instances having the specified keys.