Skip to content

Commit

Permalink
Fix flake8 issues
Browse files Browse the repository at this point in the history
Signed-off-by: Stefano Bennati <stefano.bennati@here.com>
  • Loading branch information
bennati committed Jan 12, 2023
1 parent b66a6ff commit 66c76df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
11 changes: 6 additions & 5 deletions src/resolvelib/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 = {
Expand Down
17 changes: 0 additions & 17 deletions tests/test_resolvers.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
from typing import (
Any,
Iterable,
Iterator,
List,
Mapping,
Sequence,
Set,
Tuple,
Union,
)

import pytest
from packaging.requirements import Requirement
from packaging.version import Version
Expand All @@ -22,8 +10,6 @@
Resolver,
)
from resolvelib.resolvers import (
Criterion,
RequirementInformation,
RequirementsConflicted,
Resolution,
)
Expand Down Expand Up @@ -171,9 +157,6 @@ def test_pin_conflict_with_self(monkeypatch, reporter):
Verify correct behavior of attempting to pin a candidate version that conflicts
with a previously pinned (now invalidated) version for that same candidate (#91).
"""
Candidate = Tuple[
str, Version, Sequence[str]
] # name, version, requirements
all_candidates = {
"parent": [("parent", Version("1"), ["child<2"])],
"child": [
Expand Down

0 comments on commit 66c76df

Please sign in to comment.