Skip to content

Commit

Permalink
remove redundant version string transformation code (#3989)
Browse files Browse the repository at this point in the history
  • Loading branch information
abn authored Apr 30, 2021
1 parent a516a8f commit 16031f0
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions poetry/version/version_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,6 @@ def find_recommended_require_version(self, package: Package) -> str:

def _transform_version(self, version: str, pretty_version: str) -> str:
try:
parsed = Version.parse(version)
parts = [parsed.major, parsed.minor, parsed.patch]
return f"^{Version.parse(version).to_string()}"
except ValueError:
return pretty_version

parts = parts[: parsed.precision]

# check to see if we have a semver-looking version
if len(parts) < 3:
version = pretty_version
else:
version = ".".join(str(p) for p in parts)
if parsed.is_unstable():
version += f"-{parsed.pre.to_string()}"

return f"^{version}"

0 comments on commit 16031f0

Please sign in to comment.