-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
chore: use fstrings #4794
chore: use fstrings #4794
Conversation
bfc40f7
to
01aeb55
Compare
There was a problem hiding this comment.
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).
3027028
to
ea8bccf
Compare
@@ -818,8 +812,8 @@ def test_create_venv_uses_patch_version_to_detect_compatibility( | |||
del os.environ["VIRTUAL_ENV"] | |||
|
|||
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above note.
tests/utils/test_env.py
Outdated
@@ -852,8 +846,8 @@ def test_create_venv_uses_patch_version_to_detect_compatibility_with_executable( | |||
del os.environ["VIRTUAL_ENV"] | |||
|
|||
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( |
There was a problem hiding this comment.
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.
@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! |
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. |
ea8bccf
to
6ad7bc9
Compare
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 |
@@ -256,7 +242,7 @@ def and_to_string( | |||
if this_line is not None: | |||
buffer.append(" " + str(this_line)) |
There was a problem hiding this comment.
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.
@@ -256,7 +242,7 @@ def and_to_string( | |||
if this_line is not None: | |||
buffer.append(" " + str(this_line)) | |||
|
|||
buffer.append(f" and {str(other)}") | |||
buffer.append(f" and {other!s}") | |||
|
|||
if other_line is not None: | |||
buffer.append(" " + str(other_line)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above.
@@ -502,7 +498,7 @@ def test_deactivate_activated( | |||
del os.environ["VIRTUAL_ENV"] | |||
|
|||
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]) |
There was a problem hiding this comment.
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.
6ad7bc9
to
ab6e7b3
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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. |
Pull Request Check List
Towards #4776