Skip to content

chore: upgrade codebase to 3.6+ - #179

Closed
branchv wants to merge 1 commit into
python-poetry:masterfrom
branchv:chore/upgrade-py36
Closed

branchv wants to merge 1 commit into
python-poetry:masterfrom
branchv:chore/upgrade-py36

Conversation

@branchv

@branchv branchv commented May 18, 2021

Copy link
Copy Markdown
Member

Relates-to: python-poetry/poetry#3860

  • Added tests for changed code.
  • Updated documentation for changed code.

In the same spirit as python-poetry/poetry#3988, this:

  • Applies pyupgrade --py36-plus to the codebase
  • Adds the above to .pre-commit-config.yaml

@kamyar

kamyar commented Jun 11, 2021

Copy link
Copy Markdown

@branchvincent any specific reason to reopen same change when there is already #3988 ?

@branchv

branchv commented Jun 11, 2021

Copy link
Copy Markdown
Member Author

@branchvincent any specific reason to reopen same change when there is already #3988 ?

hey @kamyar! your pr is for poetry while this is for poetry-core

@kamyar

kamyar commented Jun 11, 2021

Copy link
Copy Markdown

Sorry missed that 🤦 😞
Thank you for pointing it out

constraints = self.pretty_constraint.split(",")
constraints = [parse_constraint(c) for c in constraints]
constraints = [str(c) for c in constraints]
requirement += " ({})".format(",".join(constraints))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement += " ({})".format(",".join(constraints))
requirement += f" ({','.join(constraints)})"

requirement += " (=={})".format(self.constraint.text)
requirement += f" (=={self.constraint.text})"
elif not self.constraint.is_any():
requirement += " ({})".format(str(self.constraint).replace(" ", ""))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement += " ({})".format(str(self.constraint).replace(" ", ""))
requirement += f' ({str(self.constraint).replace(" ", "")})'

if len(markers) > 1:
markers = ["({})".format(m) for m in markers]
markers = [f"({m})" for m in markers]
requirement += "; {}".format(" and ".join(markers))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement += "; {}".format(" and ".join(markers))
requirement += f"; {' and '.join(markers)}"

@@ -123,7 +123,7 @@ def base_pep_508_name(self) -> str:
requirement += "[{}]".format(",".join(self.extras))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement += "[{}]".format(",".join(self.extras))
requirement += f"[{','.join(self.extras)}]"

@@ -108,7 +108,7 @@ def base_pep_508_name(self) -> str:
requirement += "[{}]".format(",".join(self.extras))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement += "[{}]".format(",".join(self.extras))
requirement += f"[{','.join(self.extras)}]"

@@ -48,7 +48,7 @@ def base_pep_508_name(self) -> str:
if self.extras:
requirement += "[{}]".format(",".join(self.extras))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement += "[{}]".format(",".join(self.extras))
requirement += f"[{','.join(self.extras)}]"

@@ -108,7 +108,7 @@ def base_pep_508_name(self) -> str:
requirement += "[{}]".format(",".join(self.extras))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement += "[{}]".format(",".join(self.extras))
requirement += f"[{','.join(self.extras)}]"

requirement += " @ {}+{}@{}".format(self._vcs, self._source, self.reference)
requirement += f" @ {self._vcs}+{self._source}@{self.reference}"
else:
requirement += " @ {}+ssh://{}@{}".format(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It missing to apply the f-string on line 113.

version_string = f"{self.epoch}!{version_string}"

if self.local:
version_string += "+{}".format(".".join(map(str, self.local)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version_string += "+{}".format(".".join(map(str, self.local)))
version_string += f"+{'.'.join(map(str, self.local))}"


if self.extras:
parts.append("[{0}]".format(",".join(sorted(self.extras))))
parts.append("[{}]".format(",".join(sorted(self.extras))))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parts.append("[{}]".format(",".join(sorted(self.extras))))
parts.append(f"[{','.join(sorted(self.extras))}]")

@branchv

branchv commented Nov 15, 2021

Copy link
Copy Markdown
Member Author

closing in favor of #230

@branchv branchv closed this Nov 15, 2021
@branchv
branchv deleted the chore/upgrade-py36 branch November 15, 2021 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants