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

[pyupgrade] Use f-strings for formatting #9745

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def describe_trigger(parent):
relevant_constraints.add(req.name)
msg = msg + "\n "
if parent:
msg = msg + "{} {} depends on ".format(parent.name, parent.version)
msg = msg + f"{parent.name} {parent.version} depends on "
else:
msg = msg + "The user requested "
msg = msg + req.format_for_error()
Expand Down
4 changes: 1 addition & 3 deletions src/pip/_internal/utils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ def get_path_uid(path):
file_uid = os.stat(path).st_uid
else:
# raise OSError for parity with os.O_NOFOLLOW above
raise OSError(
"{} is a symlink; Will not return uid for symlinks".format(path)
)
raise OSError(f"{path} is a symlink; Will not return uid for symlinks")
return file_uid


Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def _check_no_input(message):
"""Raise an error if no input is allowed."""
if os.environ.get("PIP_NO_INPUT"):
raise Exception(
"No input was expected ($PIP_NO_INPUT set); question: {}".format(message)
f"No input was expected ($PIP_NO_INPUT set); question: {message}"
)


Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/utils/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def call_subprocess(
elif on_returncode == "ignore":
pass
else:
raise ValueError("Invalid value: on_returncode={!r}".format(on_returncode))
raise ValueError(f"Invalid value: on_returncode={on_returncode!r}")
return output


Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/utils/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_metadata(self, name):
except UnicodeDecodeError as e:
# Augment the default error with the origin of the file.
raise UnsupportedWheel(
"Error decoding metadata for {}: {}".format(self._wheel_name, e)
f"Error decoding metadata for {self._wheel_name}: {e}"
)


Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_install_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def test_prompt_for_keyring_if_needed(script, data, cert_factory, auth_needed):
response(str(data.packages / "simple-3.0.tar.gz")),
]

url = "https://{}:{}/simple".format(server.host, server.port)
url = f"https://{server.host}:{server.port}/simple"

keyring_content = textwrap.dedent("""\
import os
Expand Down