incompatibility_cause.py (poetry-1.1.15) | : | incompatibility_cause.py (poetry-1.2.0) | ||
---|---|---|---|---|
from __future__ import annotations | ||||
from typing import TYPE_CHECKING | ||||
if TYPE_CHECKING: | ||||
from poetry.mixology.incompatibility import Incompatibility | ||||
class IncompatibilityCause(Exception): | class IncompatibilityCause(Exception): | |||
""" | """ | |||
The reason and Incompatibility's terms are incompatible. | The reason and Incompatibility's terms are incompatible. | |||
""" | """ | |||
class RootCause(IncompatibilityCause): | class RootCause(IncompatibilityCause): | |||
pass | pass | |||
class NoVersionsCause(IncompatibilityCause): | class NoVersionsCause(IncompatibilityCause): | |||
pass | pass | |||
class DependencyCause(IncompatibilityCause): | class DependencyCause(IncompatibilityCause): | |||
pass | pass | |||
class ConflictCause(IncompatibilityCause): | class ConflictCause(IncompatibilityCause): | |||
""" | """ | |||
The incompatibility was derived from two existing incompatibilities | The incompatibility was derived from two existing incompatibilities | |||
during conflict resolution. | during conflict resolution. | |||
""" | """ | |||
def __init__(self, conflict, other): | def __init__(self, conflict: Incompatibility, other: Incompatibility) -> Non e: | |||
self._conflict = conflict | self._conflict = conflict | |||
self._other = other | self._other = other | |||
@property | @property | |||
def conflict(self): | def conflict(self) -> Incompatibility: | |||
return self._conflict | return self._conflict | |||
@property | @property | |||
def other(self): | def other(self) -> Incompatibility: | |||
return self._other | return self._other | |||
def __str__(self): | def __str__(self) -> str: | |||
return str(self._conflict) | return str(self._conflict) | |||
class PythonCause(IncompatibilityCause): | class PythonCause(IncompatibilityCause): | |||
""" | """ | |||
The incompatibility represents a package's python constraint | The incompatibility represents a package's python constraint | |||
(Python versions) being incompatible | (Python versions) being incompatible | |||
with the current python version. | with the current python version. | |||
""" | """ | |||
def __init__(self, python_version, root_python_version): | def __init__(self, python_version: str, root_python_version: str) -> None: | |||
self._python_version = python_version | self._python_version = python_version | |||
self._root_python_version = root_python_version | self._root_python_version = root_python_version | |||
@property | @property | |||
def python_version(self): | def python_version(self) -> str: | |||
return self._python_version | return self._python_version | |||
@property | @property | |||
def root_python_version(self): | def root_python_version(self) -> str: | |||
return self._root_python_version | return self._root_python_version | |||
class PlatformCause(IncompatibilityCause): | class PlatformCause(IncompatibilityCause): | |||
""" | """ | |||
The incompatibility represents a package's platform constraint | The incompatibility represents a package's platform constraint | |||
(OS most likely) being incompatible with the current platform. | (OS most likely) being incompatible with the current platform. | |||
""" | """ | |||
def __init__(self, platform): | def __init__(self, platform: str) -> None: | |||
self._platform = platform | self._platform = platform | |||
@property | @property | |||
def platform(self): | def platform(self) -> str: | |||
return self._platform | return self._platform | |||
class PackageNotFoundCause(IncompatibilityCause): | class PackageNotFoundCause(IncompatibilityCause): | |||
""" | """ | |||
The incompatibility represents a package that couldn't be found by its | The incompatibility represents a package that couldn't be found by its | |||
source. | source. | |||
""" | """ | |||
def __init__(self, error): | def __init__(self, error: Exception) -> None: | |||
self._error = error | self._error = error | |||
@property | @property | |||
def error(self): | def error(self) -> Exception: | |||
return self._error | return self._error | |||
End of changes. 15 change blocks. | ||||
14 lines changed or deleted | 18 lines changed or added |