From 0fa102aac5e5a620ac719e86facb1934b8bd82b2 Mon Sep 17 00:00:00 2001 From: Stefano Bennati Date: Thu, 12 Jan 2023 16:18:33 +0100 Subject: [PATCH] Fix flake8 issues Signed-off-by: Stefano Bennati --- src/resolvelib/resolvers.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/resolvelib/resolvers.py b/src/resolvelib/resolvers.py index d90a03b4..343bb343 100644 --- a/src/resolvelib/resolvers.py +++ b/src/resolvelib/resolvers.py @@ -283,10 +283,10 @@ def _backjump(self, causes): Each iteration of the loop will: - 1. Identify Z. The incompatibility is not necessarily caused by the latest state. + 1. Identify Z. The incompatibility is not always caused by the latest state. For example, given three requirements A, B and C, with dependencies - A1, B1 and C1, where A1 and B1 are incompatible: - the last state might be related to C, so we want to discard the previous state. + A1, B1 and C1, where A1 and B1 are incompatible: the last state + might be related to C, so we want to discard the previous state. 2. Discard Z. 3. Discard Y but remember its incompatibility information gathered previously, and the failure we're dealing with right now. @@ -310,9 +310,10 @@ def _backjump(self, causes): # Retrieve the last candidate pin and known incompatibilities. try: broken_state = self._states.pop() - except: + except IndexError: raise Exception( - "Exhausted all states during backjumping, impossible to find a fully-compatible dependency tree." + "Exhausted all states during backjumping, " + "impossible to find a fully-compatible dependency tree." ) name, candidate = broken_state.mapping.popitem() current_dependencies = {