Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions poetry/core/semver/empty_constraint.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
from typing import TYPE_CHECKING

from .version_constraint import VersionConstraint


if TYPE_CHECKING:
from . import VersionTypes # noqa
from .version import Version # noqa


class EmptyConstraint(VersionConstraint):
def is_empty(self) -> bool:
return True

def is_any(self) -> bool:
return False

def allows(self, version: "Version") -> bool:
def allows(self, _version: VersionConstraint) -> bool:
return False

def allows_all(self, other: "VersionTypes") -> bool:
def allows_all(self, other: VersionConstraint) -> bool:
return other.is_empty()

def allows_any(self, other: "VersionTypes") -> bool:
def allows_any(self, _other: VersionConstraint) -> bool:
return False

def intersect(self, other: "VersionTypes") -> "EmptyConstraint":
def intersect(self, _other: VersionConstraint) -> "EmptyConstraint":
return self

def union(self, other: "VersionTypes") -> "VersionTypes":
def union(self, other: VersionConstraint) -> VersionConstraint:
return other

def difference(self, other: "VersionTypes") -> "EmptyConstraint":
def difference(self, _other: VersionConstraint) -> "EmptyConstraint":
return self

def __str__(self) -> str:
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ module = [
'poetry.core.packages.*',
'poetry.core.poetry.*',
'poetry.core.pyproject.*',
'poetry.core.semver.*',
'poetry.core.semver.helpers.*',
'poetry.core.semver.version.*',
'poetry.core.semver.version_range.*',
'poetry.core.semver.version_union.*',
'poetry.core.spdx.*',
'poetry.core.vcs.*',
'poetry.core.version.*',
Expand Down