From 8f96964beb2cc2259ba67e03523a96fcb4c404af Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Tue, 31 May 2011 11:13:30 +0200 Subject: [PATCH] [entropy.client.interfaces.dep] use set intersection instead of doubly nested for loops --- libraries/entropy/client/interfaces/dep.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libraries/entropy/client/interfaces/dep.py b/libraries/entropy/client/interfaces/dep.py index 001104f8c..c547cab0e 100644 --- a/libraries/entropy/client/interfaces/dep.py +++ b/libraries/entropy/client/interfaces/dep.py @@ -1223,13 +1223,9 @@ class CalculatorsMixin: # too much generic and could pull in conflicting packages. # NOTE: this is a hack and real weighted graph would be required mymatches, rc = self.atom_match(key, match_slot = slot, - multi_match = True) - got_it = None - for xmymatch in mymatches: - if xmymatch in elements_cache: - got_it = xmymatch - break - if got_it is not None: + multi_match = True, multi_repo = True) + got_it = mymatches & elements_cache + if got_it: if const_debug_enabled(): atom = self.open_repository(mymatch[1]).retrieveAtom( mymatch[0])