Skip to content

Commit a196b3b

Browse files
authored
Minor formatting tweaks (#10190)
Co-authored-by: Pradyun Gedam <[email protected]>
1 parent 2de3af1 commit a196b3b

File tree

8 files changed

+25
-19
lines changed

8 files changed

+25
-19
lines changed

src/pip/_internal/locations/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,15 @@ def _log_context(
7272
root: Optional[str] = None,
7373
prefix: Optional[str] = None,
7474
) -> None:
75-
message = (
76-
"Additional context:" "\nuser = %r" "\nhome = %r" "\nroot = %r" "\nprefix = %r"
77-
)
78-
logger.log(_MISMATCH_LEVEL, message, user, home, root, prefix)
75+
parts = [
76+
"Additional context:",
77+
"user = %r",
78+
"home = %r",
79+
"root = %r",
80+
"prefix = %r",
81+
]
82+
83+
logger.log(_MISMATCH_LEVEL, "\n".join(parts), user, home, root, prefix)
7984

8085

8186
def get_scheme(

src/pip/_internal/resolution/legacy/resolver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _check_dist_requires_python(
8383
version = ".".join(map(str, version_info))
8484
if ignore_requires_python:
8585
logger.debug(
86-
"Ignoring failed Requires-Python check for package %r: " "%s not in %r",
86+
"Ignoring failed Requires-Python check for package %r: %s not in %r",
8787
dist.project_name,
8888
version,
8989
requires_python,
@@ -344,7 +344,7 @@ def _get_dist_for(self, req: InstallRequirement) -> Distribution:
344344
self._set_req_to_reinstall(req)
345345
else:
346346
logger.info(
347-
"Requirement already satisfied (use --upgrade to upgrade):" " %s",
347+
"Requirement already satisfied (use --upgrade to upgrade): %s",
348348
req,
349349
)
350350
return dist

tests/functional/test_install.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,8 +1835,8 @@ def test_invalid_index_url_argument(script, shared_data):
18351835
shared_data.find_links3, "Dinner",
18361836
expect_error=True)
18371837

1838-
assert 'WARNING: The index url "--user" seems invalid, ' \
1839-
'please provide a scheme.' in result.stderr, str(result)
1838+
assert ('WARNING: The index url "--user" seems invalid, '
1839+
'please provide a scheme.') in result.stderr, str(result)
18401840

18411841

18421842
def test_valid_index_url_argument(script, shared_data):

tests/lib/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ def assert_installed(
289289
if without_egg_link:
290290
if egg_link_path in self.files_created:
291291
raise TestFailure(
292-
"unexpected egg link file created: " f"{egg_link_path!r}\n{self}"
292+
f"unexpected egg link file created: {egg_link_path!r}\n{self}"
293293
)
294294
else:
295295
if egg_link_path not in self.files_created:
296296
raise TestFailure(
297-
"expected egg link file missing: " f"{egg_link_path!r}\n{self}"
297+
f"expected egg link file missing: {egg_link_path!r}\n{self}"
298298
)
299299

300300
egg_link_file = self.files_created[egg_link_path]
@@ -344,7 +344,7 @@ def assert_installed(
344344
normalized_path = os.path.normpath(pkg_dir / f)
345345
if normalized_path not in self.files_created:
346346
raise TestFailure(
347-
f"Package directory {pkg_dir!r} missing " f"expected content {f!r}"
347+
f"Package directory {pkg_dir!r} missing expected content {f!r}"
348348
)
349349

350350
for f in without_files:
@@ -602,15 +602,15 @@ def run(
602602
# Then default to allowing logged errors.
603603
if allow_stderr_error is not None and not allow_stderr_error:
604604
raise RuntimeError(
605-
"cannot pass allow_stderr_error=False with " "expect_error=True"
605+
"cannot pass allow_stderr_error=False with expect_error=True"
606606
)
607607
allow_stderr_error = True
608608

609609
elif kw.get("expect_stderr"):
610610
# Then default to allowing logged warnings.
611611
if allow_stderr_warning is not None and not allow_stderr_warning:
612612
raise RuntimeError(
613-
"cannot pass allow_stderr_warning=False with " "expect_stderr=True"
613+
"cannot pass allow_stderr_warning=False with expect_stderr=True"
614614
)
615615
allow_stderr_warning = True
616616

tests/lib/test_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_run__allow_stderr_warning_false_error(self, script, arg_name):
223223
"""
224224
kwargs = {"allow_stderr_warning": False, arg_name: True}
225225
expected_start = (
226-
"cannot pass allow_stderr_warning=False with " "allow_stderr_error=True"
226+
"cannot pass allow_stderr_warning=False with allow_stderr_error=True"
227227
)
228228
with assert_error_startswith(RuntimeError, expected_start):
229229
script.run("python", **kwargs)

tests/unit/test_network_auth.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ def should_save_password_to_keyring(*a):
196196
# when _prompt_for_password indicates not to save, we should
197197
# never call this function
198198
def should_save_password_to_keyring(*a):
199-
assert False, ("_should_save_password_to_keyring should not be " +
200-
"called")
199+
assert False, "_should_save_password_to_keyring should not be called"
201200
monkeypatch.setattr(auth, '_should_save_password_to_keyring',
202201
should_save_password_to_keyring)
203202

tests/unit/test_req.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def test_parse_editable_local_extras(
611611
exists_mock.return_value = isdir_mock.return_value = True
612612
abspath_mock.return_value = "/some/path"
613613
assert parse_editable('.[extras]') == (
614-
None, 'file://' + "/some/path", {'extras'},
614+
None, "file:///some/path", {'extras'},
615615
)
616616
abspath_mock.return_value = "/some/path/foo"
617617
assert parse_editable('foo[bar,baz]') == (

tests/unit/test_req_file.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,10 @@ def test_nested_constraints_file(self, monkeypatch, tmpdir):
312312
assert reqs[0].constraint
313313

314314
def test_options_on_a_requirement_line(self, line_processor):
315-
line = 'SomeProject --install-option=yo1 --install-option yo2 '\
316-
'--global-option="yo3" --global-option "yo4"'
315+
line = (
316+
'SomeProject --install-option=yo1 --install-option yo2 '
317+
'--global-option="yo3" --global-option "yo4"'
318+
)
317319
filename = 'filename'
318320
req = line_processor(line, filename, 1)[0]
319321
assert req.global_options == ['yo3', 'yo4']

0 commit comments

Comments
 (0)