Skip to content

Commit

Permalink
Simplified logic (giving up possibility of early return when no match…
Browse files Browse the repository at this point in the history
…ing version is found)
  • Loading branch information
radoering committed Feb 28, 2022
1 parent d1dbddb commit 253986c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/poetry/mixology/version_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,10 @@ def _get_min(dependency: Dependency) -> tuple[bool, int]:
# required in order to not unnecessarily update dependencies with
# extras, e.g. "coverage" vs. "coverage[toml]"
locked = self._locked.get(dependency.name, None)
if locked is not None:
for version in packages:
if version.version <= locked.version:
if version.version != locked.version:
version = None
break
if locked is not None:
version = next(
(p for p in packages if p.version == locked.version), None
)
if version is None:
with suppress(IndexError):
version = packages[0]
Expand Down

0 comments on commit 253986c

Please sign in to comment.