Skip to content

Commit

Permalink
Merge pull request #10600 from nadavwe/vendoring-new-resolve-lib-version
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr authored Oct 21, 2021
2 parents d01dd4a + 93f5bf7 commit 98d9fdf
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 30 deletions.
1 change: 1 addition & 0 deletions news/resolvelib.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade resolvelib to 0.8.1
4 changes: 2 additions & 2 deletions src/pip/_vendor/resolvelib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"ResolutionTooDeep",
]

__version__ = "0.8.0"
__version__ = "0.8.1"


from .providers import AbstractProvider, AbstractResolver
from .reporters import BaseReporter
from .resolvers import (
InconsistentCandidate,
RequirementsConflicted,
Resolver,
ResolutionError,
ResolutionImpossible,
ResolutionTooDeep,
Resolver,
)
20 changes: 8 additions & 12 deletions src/pip/_vendor/resolvelib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
__version__: str

from .providers import (
AbstractResolver as AbstractResolver,
AbstractProvider as AbstractProvider,
)
from .providers import AbstractProvider as AbstractProvider
from .providers import AbstractResolver as AbstractResolver
from .reporters import BaseReporter as BaseReporter
from .resolvers import (
InconsistentCandidate as InconsistentCandidate,
RequirementsConflicted as RequirementsConflicted,
Resolver as Resolver,
ResolutionError as ResolutionError,
ResolutionImpossible as ResolutionImpossible,
ResolutionTooDeep as ResolutionTooDeep,
)
from .resolvers import InconsistentCandidate as InconsistentCandidate
from .resolvers import RequirementsConflicted as RequirementsConflicted
from .resolvers import ResolutionError as ResolutionError
from .resolvers import ResolutionImpossible as ResolutionImpossible
from .resolvers import ResolutionTooDeep as ResolutionTooDeep
from .resolvers import Resolver as Resolver
2 changes: 1 addition & 1 deletion src/pip/_vendor/resolvelib/providers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from typing import (

from .reporters import BaseReporter
from .resolvers import RequirementInformation
from .structs import KT, RT, CT, Matches
from .structs import CT, KT, RT, Matches

class Preference(Protocol):
def __lt__(self, __other: Any) -> bool: ...
Expand Down
6 changes: 6 additions & 0 deletions src/pip/_vendor/resolvelib/reporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def adding_requirement(self, requirement, parent):
requirements passed in from ``Resolver.resolve()``.
"""

def resolving_conflicts(self, causes):
"""Called when starting to attempt requirement conflict resolution.
:param causes: The information on the collision that caused the backtracking.
"""

def backtracking(self, candidate):
"""Called when rejecting a candidate during backtracking."""

Expand Down
1 change: 1 addition & 0 deletions src/pip/_vendor/resolvelib/reporters.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ class BaseReporter:
def ending(self, state: Any) -> Any: ...
def adding_requirement(self, requirement: Any, parent: Any) -> Any: ...
def backtracking(self, candidate: Any) -> Any: ...
def resolving_conflicts(self, causes: Any) -> Any: ...
def pinning(self, candidate: Any) -> Any: ...
7 changes: 3 additions & 4 deletions src/pip/_vendor/resolvelib/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from .providers import AbstractResolver
from .structs import DirectedGraph, IteratorMapping, build_iter_view


RequirementInformation = collections.namedtuple(
"RequirementInformation", ["requirement", "parent"]
)
Expand Down Expand Up @@ -374,12 +373,12 @@ def resolve(self, requirements, max_rounds):
failure_causes = self._attempt_to_pin_criterion(name)

if failure_causes:
causes = [i for c in failure_causes for i in c.information]
# Backtrack if pinning fails. The backtrack process puts us in
# an unpinned state, so we can work on it in the next round.
self._r.resolving_conflicts(causes=causes)
success = self._backtrack()
self.state.backtrack_causes[:] = [
i for c in failure_causes for i in c.information
]
self.state.backtrack_causes[:] = causes

# Dead ends everywhere. Give up.
if not success:
Expand Down
8 changes: 1 addition & 7 deletions src/pip/_vendor/resolvelib/resolvers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ from typing import (
)

from .providers import AbstractProvider, AbstractResolver
from .structs import (
CT,
KT,
RT,
DirectedGraph,
IterableView,
)
from .structs import CT, KT, RT, DirectedGraph, IterableView

# This should be a NamedTuple, but Python 3.6 has a bug that prevents it.
# https://stackoverflow.com/a/50531189/1376863
Expand Down
11 changes: 8 additions & 3 deletions src/pip/_vendor/resolvelib/structs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ from typing import (
Generic,
Iterable,
Iterator,
Mapping,
Tuple,
TypeVar,
Union,
)

KT = TypeVar("KT")
RT = TypeVar("RT")
CT = TypeVar("CT")
KT = TypeVar("KT") # Identifier.
RT = TypeVar("RT") # Requirement.
CT = TypeVar("CT") # Candidate.
_T = TypeVar("_T")

Matches = Union[Iterable[CT], Callable[[], Iterator[CT]]]

class IteratorMapping(Mapping[KT, _T], metaclass=ABCMeta):
pass

class IterableView(Container[CT], Iterable[CT], metaclass=ABCMeta):
pass

Expand Down
2 changes: 1 addition & 1 deletion src/pip/_vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ requests==2.26.0
chardet==4.0.0
idna==3.2
urllib3==1.26.7
resolvelib==0.8.0
resolvelib==0.8.1
setuptools==44.0.0
six==1.16.0
tenacity==8.0.1
Expand Down

0 comments on commit 98d9fdf

Please sign in to comment.