提交 602b22fc 编写于 作者: T Tzu-ping Chung

Update factory implementation for resolvelib 0.7.0

上级 5ab17b96
Upgrade vendored resolvelib to 0.6.0.
Upgrade vendored resolvelib to 0.7.0.
from typing import (
TYPE_CHECKING,
Dict,
Iterable,
Iterator,
Mapping,
Optional,
Sequence,
Union,
)
from typing import TYPE_CHECKING, Dict, Iterable, Iterator, Mapping, Sequence, Union
from pip._vendor.resolvelib.providers import AbstractProvider
......@@ -75,11 +66,11 @@ class PipProvider(_ProviderBase):
def get_preference(
self,
resolution, # type: Optional[Candidate]
candidates, # type: Iterable[Candidate]
information, # type: Iterable[PreferenceInformation]
):
# type: (...) -> Preference
identifier: str,
resolutions: Mapping[str, Candidate],
candidates: Mapping[str, Iterator[Candidate]],
information: Mapping[str, Iterator["PreferenceInformation"]],
) -> "Preference":
"""Produce a sort key for given requirement based on preference.
The lower the return value is, the more preferred this group of
......@@ -127,9 +118,8 @@ class PipProvider(_ProviderBase):
# A "bare" requirement without any version requirements.
return 3
restrictive = _get_restrictive_rating(req for req, _ in information)
key = next(iter(candidates)).name if candidates else ""
order = self._user_requested.get(key, float("inf"))
rating = _get_restrictive_rating(r for r, _ in information[identifier])
order = self._user_requested.get(identifier, float("inf"))
# HACK: Setuptools have a very long and solid backward compatibility
# track record, and extremely few projects would request a narrow,
......@@ -139,9 +129,9 @@ class PipProvider(_ProviderBase):
# delaying Setuptools helps reduce branches the resolver has to check.
# This serves as a temporary fix for issues like "apache-airlfow[all]"
# while we work on "proper" branch pruning techniques.
delay_this = key == "setuptools"
delay_this = identifier == "setuptools"
return (delay_this, restrictive, order, key)
return (delay_this, rating, order, identifier)
def find_matches(
self,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册