Skip to content

Commit

Permalink
move fix from relation() to _register()
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Jun 6, 2022
1 parent 6394205 commit b3e637e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/poetry/mixology/partial_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ def _register(self, assignment: Assignment) -> None:
"""
name = assignment.dependency.complete_name
old_positive = self._positive.get(name)
if old_positive is None and assignment.dependency.features:
old_positive_without_features = self._positive.get(
assignment.dependency.name
)
if old_positive_without_features is not None:
dep = old_positive_without_features.dependency.with_features(
assignment.dependency.features
)
old_positive = Term(dep, is_positive=True)
if old_positive is not None:
value = old_positive.intersect(assignment)
assert value is not None
Expand Down Expand Up @@ -213,13 +222,6 @@ def relation(self, term: Term) -> str:
if positive is not None:
return positive.relation(term)

positive = self._positive.get(term.dependency.name)
if positive is not None:
dep = positive.dependency.with_features(term.dependency.features)
positive_with_features = Term(dep, is_positive=True)
self._positive[term.dependency.complete_name] = positive_with_features
return positive_with_features.relation(term)

by_ref = self._negative.get(term.dependency.complete_name)
if by_ref is None:
return SetRelation.OVERLAPPING
Expand Down

0 comments on commit b3e637e

Please sign in to comment.