diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-23 11:34:46 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-23 11:34:46 -0700 |
commit | 3359e0116b4e592b28ac0f24fed6a1e2eabe6bf6 (patch) | |
tree | a7a6b6fb0ab70f4ef435f41daed9017d15b1e2ae | |
parent | 6cbe3e85eb13a5eb72dcc9512de818db419f2afe (diff) | |
download | portage-3359e0116b4e592b28ac0f24fed6a1e2eabe6bf6.tar.gz portage-3359e0116b4e592b28ac0f24fed6a1e2eabe6bf6.tar.bz2 portage-3359e0116b4e592b28ac0f24fed6a1e2eabe6bf6.zip |
* Use iterators instead of keys() when possible.
* Use iterators instead of sets for set.intersection() calls.
* Use digraph.__iter__ and __contains__ as shortcuts to digraph.nodes
access.
-rw-r--r-- | pym/_emerge/depgraph.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index a2c6a8c76..a682e5017 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1811,10 +1811,10 @@ class depgraph(object): except self._unknown_internal_error: return False, myfavorites - if set(self._dynamic_config.digraph.nodes.keys()).intersection( \ - set(self._dynamic_config._needed_unstable_keywords)) or \ - set(self._dynamic_config.digraph.nodes.keys()).intersection( \ - set(self._dynamic_config._needed_use_config_changes.keys())) : + if set(self._dynamic_config.digraph).intersection( \ + self._dynamic_config._needed_unstable_keywords) or \ + set(self._dynamic_config.digraph).intersection( \ + self._dynamic_config._needed_use_config_changes) : #We failed if the user needs to change the configuration return False, myfavorites @@ -2474,7 +2474,7 @@ class depgraph(object): if new_changes.get(flag) == True: return old_use new_changes[flag] = False - new_use.update(old_use.difference(target_use.keys())) + new_use.update(old_use.difference(target_use)) def want_restart_for_use_change(pkg, new_use): if pkg not in self._dynamic_config.digraph.nodes: @@ -2495,7 +2495,7 @@ class depgraph(object): new_use, changes = self._dynamic_config._needed_use_config_changes.get(pkg) for ppkg, atom in parent_atoms: if not atom.use or \ - not atom.use.required.intersection(changes.keys()): + not atom.use.required.intersection(changes): continue else: return True @@ -5196,7 +5196,7 @@ class depgraph(object): unstable_keyword_msg = [] for pkg in self._dynamic_config._needed_unstable_keywords: self._show_merge_list() - if pkg in self._dynamic_config.digraph.nodes.keys(): + if pkg in self._dynamic_config.digraph: pkgsettings = self._frozen_config.pkgsettings[pkg.root] mreasons = _get_masking_status(pkg, pkgsettings, pkg.root_config, use=self._pkg_use_enabled(pkg)) @@ -5212,7 +5212,7 @@ class depgraph(object): use_changes_msg = [] for pkg, needed_use_config_change in self._dynamic_config._needed_use_config_changes.items(): self._show_merge_list() - if pkg in self._dynamic_config.digraph.nodes.keys(): + if pkg in self._dynamic_config.digraph: changes = needed_use_config_change[1] adjustments = [] for flag, state in changes.items(): |