Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant version string transformation code #3989

Merged
merged 1 commit into from
Apr 30, 2021
Merged
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
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}"