Skip to content

Commit

Permalink
wip: add explanatory comments
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Dec 20, 2022
1 parent b82c194 commit 76418aa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/poetry/core/constraints/version/version_range_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ def allowed_min(self) -> Version | None:
if self.min is None:
return None

# That is a bit inaccurate because
# 1) The exclusive ordered comparison >V MUST NOT allow a post-release
# of the given version unless V itself is a post release.
# 2) The exclusive ordered comparison >V MUST NOT match
# a local version of the specified version.
# https://peps.python.org/pep-0440/#exclusive-ordered-comparison
# However, there is no specific min greater than the greatest post release
# or greatest local version identifier. These cases have to be handled by
# the callers of allowed_min.
return self.min

@property
Expand All @@ -50,6 +59,9 @@ def allowed_max(self) -> Version | None:
# this is an equality range
return self.max

# The exclusive ordered comparison <V MUST NOT allow a pre-release
# of the specified version unless the specified version is itself a pre-release.
# https://peps.python.org/pep-0440/#exclusive-ordered-comparison
return self.max.first_devrelease()

def allows_lower(self, other: VersionRangeConstraint) -> bool:
Expand Down

0 comments on commit 76418aa

Please sign in to comment.