"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "poetry/packages/dependency_package.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.

dependency_package.py  (poetry-1.1.15):dependency_package.py  (poetry-1.2.0)
from typing import List from __future__ import annotations
from poetry.core.packages.dependency import Dependency from typing import TYPE_CHECKING
from poetry.core.packages.package import Package
class DependencyPackage(object): if TYPE_CHECKING:
def __init__(self, dependency, package): # type: (Dependency, Package) -> N from poetry.core.packages.dependency import Dependency
one from poetry.core.packages.package import Package
class DependencyPackage:
def __init__(self, dependency: Dependency, package: Package) -> None:
self._dependency = dependency self._dependency = dependency
self._package = package self._package = package
@property @property
def dependency(self): # type: () -> Dependency def dependency(self) -> Dependency:
return self._dependency return self._dependency
@property @property
def package(self): # type: () -> Package def package(self) -> Package:
return self._package return self._package
def clone(self): # type: () -> DependencyPackage def clone(self) -> DependencyPackage:
return self.__class__(self._dependency, self._package.clone()) return self.__class__(self._dependency, self._package.clone())
def with_features(self, features): # type: (List[str]) -> "DependencyPackag e" def with_features(self, features: list[str]) -> DependencyPackage:
return self.__class__(self._dependency, self._package.with_features(feat ures)) return self.__class__(self._dependency, self._package.with_features(feat ures))
def without_features(self): # type: () -> "DependencyPackage" def without_features(self) -> DependencyPackage:
return self.with_features([]) return self.with_features([])
def __getattr__(self, name): def __str__(self) -> str:
return getattr(self._package, name)
def __setattr__(self, key, value):
if key in {"_dependency", "_package"}:
return super(DependencyPackage, self).__setattr__(key, value)
setattr(self._package, key, value)
def __str__(self):
return str(self._package) return str(self._package)
def __repr__(self): def __repr__(self) -> str:
return repr(self._package) return repr(self._package)
def __hash__(self): def __hash__(self) -> int:
return hash(self._package) return hash(self._package)
def __eq__(self, other): def __eq__(self, other: object) -> bool:
if isinstance(other, DependencyPackage): if isinstance(other, DependencyPackage):
other = other.package other = other.package
return self._package == other equal: bool = self._package == other
return equal
 End of changes. 13 change blocks. 
24 lines changed or deleted 17 lines changed or added

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