From 16dc3031904d81c7901e678c1bee4e12ed872a6b Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sat, 19 Jan 2019 18:00:59 +0000 Subject: [PATCH] solver: Reduce two small loops into a comprehension Signed-off-by: Niels Thykier --- britney2/installability/solver.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/britney2/installability/solver.py b/britney2/installability/solver.py index f7fb233..36ec655 100644 --- a/britney2/installability/solver.py +++ b/britney2/installability/solver.py @@ -16,6 +16,7 @@ import logging from collections import deque +from itertools import chain from britney2.utils import (ifilter_only, iter_except) @@ -237,15 +238,9 @@ class InstallabilitySolver(object): # that migrates based on various rules. for (item, adds, rms) in groups: key = str(item) - oldcons = set() - newcons = set() - for r in rms: - oldcons.update(universe.negative_dependencies_of(r)) - for a in adds: - newcons.update(universe.negative_dependencies_of(a)) - current = newcons & oldcons - oldcons -= current - newcons -= current + oldcons = set(chain.from_iterable(universe.negative_dependencies_of(r) for r in rms)) + newcons = set(chain.from_iterable(universe.negative_dependencies_of(a) for a in adds)) + oldcons -= newcons if oldcons: # Some of the old binaries have "conflicts" that will # be removed.