_extended_cp_re_cache[extended_cp] = extended_cp_re
return extended_cp_re.match(other_cp) is not None
-class ExtendedAtomDict(object):
+class ExtendedAtomDict(portage.cache.mappings.MutableMapping):
"""
dict() wrapper that supports extended atoms as keys and allows lookup
of a normal cp against other normal cp and extended cp.
The value type has to be given to __init__ and is assumed to be the same
for all values.
"""
+
+ __slots__ = ('_extended', '_normal', '_value_class')
+
def __init__(self, value_class):
self._extended = {}
self._normal = {}
self._normal[cp] = val
def __getitem__(self, cp):
+ if not isinstance(cp, basestring):
+ raise KeyError(cp)
if "*" in cp:
return self._extended[cp]
else: