From: Zac Medico Date: Tue, 3 Aug 2010 08:40:04 +0000 (-0700) Subject: Make ExtendedAtomDict.__getitem__() return the value directly from X-Git-Tag: v2.2_rc68~419 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5f41810c5d0fdee5f40a047a9e651a30e91f4556;p=portage.git Make ExtendedAtomDict.__getitem__() return the value directly from self._extended when given a wildcard (rather than make an unnecessary copy). --- diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 12e32c36d..0ba96bdec 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -796,6 +796,9 @@ class ExtendedAtomDict(portage.cache.mappings.MutableMapping): if not isinstance(cp, basestring): raise KeyError(cp) + if '*' in cp: + return self._extended[cp] + ret = self._value_class() normal_match = self._normal.get(cp) match = False @@ -809,26 +812,15 @@ class ExtendedAtomDict(portage.cache.mappings.MutableMapping): else: raise NotImplementedError() - if '*' in cp: - v = self._extended.get(cp) - if v is not None: + for extended_cp in self._extended: + if extended_cp_match(extended_cp, cp): match = True if hasattr(ret, "update"): - ret.update(v) + ret.update(self._extended[extended_cp]) elif hasattr(ret, "extend"): - ret.extend(v) + ret.extend(self._extended[extended_cp]) else: raise NotImplementedError() - else: - for extended_cp in self._extended: - if extended_cp_match(extended_cp, cp): - match = True - if hasattr(ret, "update"): - ret.update(self._extended[extended_cp]) - elif hasattr(ret, "extend"): - ret.extend(self._extended[extended_cp]) - else: - raise NotImplementedError() if not match: raise KeyError(cp)