python_requirement_solution_provider.py (poetry-1.1.15) | : | python_requirement_solution_provider.py (poetry-1.2.0) | ||
---|---|---|---|---|
from __future__ import annotations | ||||
import re | import re | |||
from typing import List | from typing import TYPE_CHECKING | |||
from crashtest.contracts.has_solutions_for_exception import HasSolutionsForExcep tion | from crashtest.contracts.has_solutions_for_exception import HasSolutionsForExcep tion | |||
from crashtest.contracts.solution import Solution | ||||
class PythonRequirementSolutionProvider(HasSolutionsForException): | if TYPE_CHECKING: | |||
def can_solve(self, exception): # type: (Exception) -> bool | from crashtest.contracts.solution import Solution | |||
from poetry.puzzle.exceptions import SolverProblemError | ||||
class PythonRequirementSolutionProvider(HasSolutionsForException): # type: igno | ||||
re[misc] | ||||
def can_solve(self, exception: Exception) -> bool: | ||||
from poetry.puzzle.exceptions import SolverProblemError | from poetry.puzzle.exceptions import SolverProblemError | |||
if not isinstance(exception, SolverProblemError): | if not isinstance(exception, SolverProblemError): | |||
return False | return False | |||
m = re.match( | m = re.match( | |||
"^The current project's Python requirement (.+) is not compatible " | "^The current project's Python requirement (.+) is not compatible " | |||
"with some of the required packages Python requirement", | "with some of the required packages Python requirement", | |||
str(exception), | str(exception), | |||
) | ) | |||
if not m: | return bool(m) | |||
return False | ||||
return True | ||||
def get_solutions(self, exception): # type: (Exception) -> List[Solution] | def get_solutions(self, exception: SolverProblemError) -> list[Solution]: | |||
from ..solutions.python_requirement_solution import PythonRequirementSol | from poetry.mixology.solutions.solutions.python_requirement_solution imp | |||
ution | ort ( | |||
PythonRequirementSolution, | ||||
) | ||||
return [PythonRequirementSolution(exception)] | return [PythonRequirementSolution(exception)] | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 17 lines changed or added |