Skip to content

Commit

Permalink
We don't need _is_current_pin_satisfying here
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Apr 28, 2020
1 parent d30b3c1 commit 4aa7160
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/resolvelib/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,24 @@ def _attempt_to_pin_criterion(self, name, criterion):
causes.append(e.criterion)
continue

# Check the newly-pinned candidate actually works. This should
# always pass under normal circumstances, but in the case of a
# faulty provider, we will raise an error to notify the implementer
# to fix find_matches() and/or is_satisfied_by().
satisfied = all(
self._p.is_satisfied_by(r, candidate)
for r in criterion.iter_requirement()
)
if not satisfied:
raise InconsistentCandidate(candidate, criterion)

# Put newly-pinned candidate at the end. This is essential because
# backtracking looks at this mapping to get the last pin.
self._r.pinning(candidate)
self.state.mapping.pop(name, None)
self.state.mapping[name] = candidate
self.state.criteria.update(criteria)

# Check the newly-pinned candidate actually works. This should
# always pass under normal circumstances, but in the case of a
# faulty provider, we will raise an error to notify the implementer
# to fix find_matches() and/or is_satisfied_by().
if not self._is_current_pin_satisfying(name, criterion):
raise InconsistentCandidate(candidate, criterion)

return []

# All candidates tried, nothing works. This criterion is a dead
Expand Down

0 comments on commit 4aa7160

Please sign in to comment.