"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "poetry/mixology/assignment.py" between
poetry-1.1.15.tar.gz and poetry-1.2.0.tar.gz

About: Poetry is a tool for dependency management and packaging in Python.

assignment.py  (poetry-1.1.15):assignment.py  (poetry-1.2.0)
from typing import Any from __future__ import annotations
from .incompatibility import Incompatibility from typing import TYPE_CHECKING
from .term import Term
from poetry.mixology.term import Term
if TYPE_CHECKING:
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.package import Package
from poetry.mixology.incompatibility import Incompatibility
class Assignment(Term): class Assignment(Term):
""" """
A term in a PartialSolution that tracks some additional metadata. A term in a PartialSolution that tracks some additional metadata.
""" """
def __init__(self, dependency, is_positive, decision_level, index, cause=Non def __init__(
e): self,
super(Assignment, self).__init__(dependency, is_positive) dependency: Dependency,
is_positive: bool,
decision_level: int,
index: int,
cause: Incompatibility | None = None,
) -> None:
super().__init__(dependency, is_positive)
self._decision_level = decision_level self._decision_level = decision_level
self._index = index self._index = index
self._cause = cause self._cause = cause
@property @property
def decision_level(self): # type: () -> int def decision_level(self) -> int:
return self._decision_level return self._decision_level
@property @property
def index(self): # type: () -> int def index(self) -> int:
return self._index return self._index
@property @property
def cause(self): # type: () -> Incompatibility def cause(self) -> Incompatibility | None:
return self._cause return self._cause
@classmethod @classmethod
def decision( def decision(cls, package: Package, decision_level: int, index: int) -> Assi
cls, package, decision_level, index gnment:
): # type: (Any, int, int) -> Assignment
return cls(package.to_dependency(), True, decision_level, index) return cls(package.to_dependency(), True, decision_level, index)
@classmethod @classmethod
def derivation( def derivation(
cls, dependency, is_positive, cause, decision_level, index cls,
): # type: (Any, bool, Incompatibility, int, int) -> Assignment dependency: Dependency,
is_positive: bool,
cause: Incompatibility,
decision_level: int,
index: int,
) -> Assignment:
return cls(dependency, is_positive, decision_level, index, cause) return cls(dependency, is_positive, decision_level, index, cause)
def is_decision(self): # type: () -> bool def is_decision(self) -> bool:
return self._cause is None return self._cause is None
 End of changes. 9 change blocks. 
15 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)