diff options
author | 2010-08-03 01:40:04 -0700 | |
---|---|---|
committer | 2010-08-03 01:40:04 -0700 | |
commit | 5f41810c5d0fdee5f40a047a9e651a30e91f4556 (patch) | |
tree | ddf153621e628a4450a92c3e4fa68fba7c472fc9 | |
parent | Move the */* code out of loops for greater efficiency. (diff) | |
download | portage-multirepo-5f41810c5d0fdee5f40a047a9e651a30e91f4556.tar.gz portage-multirepo-5f41810c5d0fdee5f40a047a9e651a30e91f4556.tar.bz2 portage-multirepo-5f41810c5d0fdee5f40a047a9e651a30e91f4556.zip |
Make ExtendedAtomDict.__getitem__() return the value directly from
self._extended when given a wildcard (rather than make an unnecessary
copy).
-rw-r--r-- | pym/portage/dep/__init__.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 12e32c36..0ba96bde 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) |