Skip to content

chore: use fstrings - #4794

Merged
neersighted merged 1 commit into
python-poetry:masterfrom
branchv:fstrings
Nov 28, 2021
Merged

neersighted merged 1 commit into
python-poetry:masterfrom
branchv:fstrings

Conversation

@branchv

@branchv branchv commented Nov 18, 2021

Copy link
Copy Markdown
Member

Pull Request Check List

Towards #4776

@neersighted neersighted left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Side note: would love to see commands.debug.info and commands.env.info refactored to use Cleo's Table instead of the ad-hoc alignment they have going on right now (as future work, not in this PR).

Comment thread src/poetry/console/application.py Resolved
Comment thread src/poetry/console/commands/install.py Resolved
Comment thread src/poetry/mixology/term.py Resolved
Comment thread src/poetry/utils/password_manager.py Resolved
Comment thread src/poetry/utils/setup_reader.py Resolved
Comment thread tests/utils/test_env.py Resolved
Comment thread tests/utils/test_env.py Resolved
@branchv
branchv requested a review from neersighted November 19, 2021 04:11
Comment thread src/poetry/console/commands/config.py Resolved
Comment thread src/poetry/console/commands/install.py Resolved
Comment thread src/poetry/console/commands/install.py Resolved
Comment thread src/poetry/console/commands/install.py Resolved
Comment thread .flake8 Resolved
Comment thread tests/utils/test_env.py
version = Version.parse(".".join(str(c) for c in sys.version_info[:3]))
poetry.package.python_versions = "^{}".format(
".".join(str(c) for c in sys.version_info[:3])
poetry.package.python_versions = "^" + ".".join(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Above note.

Comment thread tests/utils/test_env.py Outdated
version = Version.parse(".".join(str(c) for c in sys.version_info[:3]))
poetry.package.python_versions = "~{}".format(
".".join(str(c) for c in (version.major, version.minor - 1, 0))
poetry.package.python_versions = "~" + ".".join(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Above? This one is a little different but maybe still doable.

Comment thread tests/utils/test_env.py Resolved
Comment thread tests/utils/test_env.py Resolved
Comment thread tests/utils/test_env.py Resolved
@neersighted

Copy link
Copy Markdown
Member

@branchvincent Sorry about the blockbuster review! There's a lot of churn here and it's important to both make sure our changes are beneficial as well as address any low-hanging code-quality fruit we discover. Thanks for bearing with me!

@neersighted

Copy link
Copy Markdown
Member

Hey @branchvincent, just wanted to see if you were close to finishing this -- given the amount of churn, conflicts will build up quickly. If not I can easily pick up the torch, and we can also discuss merging without some of my proposed refactors if you're blocked on those.

@branchv

branchv commented Nov 28, 2021

Copy link
Copy Markdown
Member Author

thanks for the ping @neersighted, i've rebased / pushed my latest changes. the only thing i had left to address was the version specifier helper (see my reply #4794 (comment)). i'm 👍 to merge this and address that in a follow up

@branchv
branchv requested a review from neersighted November 28, 2021 06:28
Comment thread src/poetry/puzzle/provider.py Resolved
Comment thread src/poetry/mixology/incompatibility.py Outdated
@@ -256,7 +242,7 @@ def and_to_string(
if this_line is not None:
buffer.append(" " + str(this_line))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we might as well turn these in to f-strings (with !s) for consistency.

Comment thread src/poetry/mixology/incompatibility.py Outdated
buffer.append(f" and {other!s}")

if other_line is not None:
buffer.append(" " + str(other_line))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Above.

Comment thread tests/utils/test_env.py

venv_name = manager.generate_env_name("simple-project", str(poetry.file.parent))
version = Version.parse(".".join(str(c) for c in sys.version_info[:3]))
version = Version.from_parts(*sys.version_info[:3])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome change! This pattern is really common and I'd like to see us replace it more generally.

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
8.2% 8.2% Duplication

@neersighted
neersighted merged commit 5814e33 into python-poetry:master Nov 28, 2021
@branchv
branchv deleted the fstrings branch November 28, 2021 15:36
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants