Package portage :: Package cache :: Module mappings
[hide private]

Module mappings

source code

Classes [hide private]
  ProtectedDict
given an initial dict, this wraps that dict storing changes in a secondary dict, protecting the underlying dict from changes
  LazyLoad
Lazy loading of values for a dict
Functions [hide private]
SlotDict
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__.
source code
Variables [hide private]
  _slot_dict_classes = <WeakValueDictionary at 144137676>

Imports: UserDict, warnings, weakref


Function Details [hide private]

slot_dict_class(keys, prefix='_val_')

source code 

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
Returns: SlotDict
A class that constructs SlotDict instances having the specified keys.