Skip to content

Commit 58ca200

Browse files
authored
Merge pull request #9745 from hexagonrecursion/f-str
[pyupgrade] Use f-strings for formatting
2 parents 5803bb6 + 622f104 commit 58ca200

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

src/pip/_internal/resolution/resolvelib/factory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def describe_trigger(parent):
514514
relevant_constraints.add(req.name)
515515
msg = msg + "\n "
516516
if parent:
517-
msg = msg + "{} {} depends on ".format(parent.name, parent.version)
517+
msg = msg + f"{parent.name} {parent.version} depends on "
518518
else:
519519
msg = msg + "The user requested "
520520
msg = msg + req.format_for_error()

src/pip/_internal/utils/compat.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ def get_path_uid(path):
4949
file_uid = os.stat(path).st_uid
5050
else:
5151
# raise OSError for parity with os.O_NOFOLLOW above
52-
raise OSError(
53-
"{} is a symlink; Will not return uid for symlinks".format(path)
54-
)
52+
raise OSError(f"{path} is a symlink; Will not return uid for symlinks")
5553
return file_uid
5654

5755

src/pip/_internal/utils/misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def _check_no_input(message):
193193
"""Raise an error if no input is allowed."""
194194
if os.environ.get("PIP_NO_INPUT"):
195195
raise Exception(
196-
"No input was expected ($PIP_NO_INPUT set); question: {}".format(message)
196+
f"No input was expected ($PIP_NO_INPUT set); question: {message}"
197197
)
198198

199199

src/pip/_internal/utils/subprocess.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def call_subprocess(
252252
elif on_returncode == "ignore":
253253
pass
254254
else:
255-
raise ValueError("Invalid value: on_returncode={!r}".format(on_returncode))
255+
raise ValueError(f"Invalid value: on_returncode={on_returncode!r}")
256256
return output
257257

258258

src/pip/_internal/utils/wheel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_metadata(self, name):
3636
except UnicodeDecodeError as e:
3737
# Augment the default error with the origin of the file.
3838
raise UnsupportedWheel(
39-
"Error decoding metadata for {}: {}".format(self._wheel_name, e)
39+
f"Error decoding metadata for {self._wheel_name}: {e}"
4040
)
4141

4242

tests/functional/test_install_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def test_prompt_for_keyring_if_needed(script, data, cert_factory, auth_needed):
298298
response(str(data.packages / "simple-3.0.tar.gz")),
299299
]
300300

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

303303
keyring_content = textwrap.dedent("""\
304304
import os

0 commit comments

Comments
 (0)