Skip to content

Commit 585037a

Browse files
committed
Cleanup implicit string concatenation
1 parent 9499925 commit 585037a

22 files changed

+63
-57
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ repos:
2828
additional_dependencies: [
2929
'flake8-bugbear==20.1.4',
3030
'flake8-logging-format==0.6.0',
31+
'flake8-implicit-str-concat==0.2.0',
3132
]
3233
exclude: tests/data
3334

src/pip/_internal/index/package_finder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _check_link_requires_python(
8686
return False
8787

8888
logger.debug(
89-
"Ignoring failed Requires-Python check (%s not in: %r) " "for link: %s",
89+
"Ignoring failed Requires-Python check (%s not in: %r) for link: %s",
9090
version,
9191
link.requires_python,
9292
link,
@@ -935,7 +935,7 @@ def _format_versions(cand_iter: Iterable[InstallationCandidate]) -> str:
935935
if best_installed:
936936
# We have an existing version, and its the best version
937937
logger.debug(
938-
"Installed version (%s) is most up-to-date (past versions: " "%s)",
938+
"Installed version (%s) is most up-to-date (past versions: %s)",
939939
installed_version,
940940
_format_versions(best_candidate_result.iter_applicable()),
941941
)

src/pip/_internal/models/search_scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def get_formatted_locations(self) -> str:
8888
# exceptions for malformed URLs
8989
if not purl.scheme and not purl.netloc:
9090
logger.warning(
91-
'The index url "%s" seems invalid, ' "please provide a scheme.",
91+
'The index url "%s" seems invalid, please provide a scheme.',
9292
redacted_index_url,
9393
)
9494

src/pip/_internal/operations/freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def freeze(
150150
", ".join(sorted(set(files))),
151151
)
152152

153-
yield ("## The following requirements were added by " "pip freeze:")
153+
yield ("## The following requirements were added by pip freeze:")
154154
for installation in sorted(installations.values(), key=lambda x: x.name.lower()):
155155
if installation.canonical_name not in skip:
156156
yield str(installation).rstrip()

src/pip/_internal/operations/prepare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def _check_download_dir(
254254
hashes.check_against_path(download_path)
255255
except HashMismatch:
256256
logger.warning(
257-
"Previously-downloaded file %s has bad hash. " "Re-downloading.",
257+
"Previously-downloaded file %s has bad hash. Re-downloading.",
258258
download_path,
259259
)
260260
os.unlink(download_path)
@@ -409,7 +409,7 @@ def _fetch_metadata_using_lazy_wheel(self, link: Link) -> Optional[Distribution]
409409
return None
410410
if link.is_file or not link.is_wheel:
411411
logger.debug(
412-
"Lazy wheel is not used as " "%r does not points to a remote wheel",
412+
"Lazy wheel is not used as %r does not points to a remote wheel",
413413
link,
414414
)
415415
return None

src/pip/_internal/wheel_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _should_build(
7474

7575
if not check_binary_allowed(req):
7676
logger.info(
77-
"Skipping wheel build for %s, due to binaries " "being disabled for it.",
77+
"Skipping wheel build for %s, due to binaries being disabled for it.",
7878
req.name,
7979
)
8080
return False
@@ -265,7 +265,7 @@ def _build_one_inside_env(
265265
wheel_hash, length = hash_file(wheel_path)
266266
shutil.move(wheel_path, dest_path)
267267
logger.info(
268-
"Created wheel for %s: " "filename=%s size=%d sha256=%s",
268+
"Created wheel for %s: filename=%s size=%d sha256=%s",
269269
req.name,
270270
wheel_name,
271271
length,

tests/functional/test_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def cache_dir(script):
1010
result = script.run(
1111
"python",
1212
"-c",
13-
"from pip._internal.locations import USER_CACHE_DIR;" "print(USER_CACHE_DIR)",
13+
"from pip._internal.locations import USER_CACHE_DIR;print(USER_CACHE_DIR)",
1414
)
1515
return result.stdout.strip()
1616

tests/functional/test_completion.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ def test_completion_files_after_option(autocomplete, data):
177177
cword="3",
178178
cwd=data.completion_paths,
179179
)
180-
assert "requirements.txt" in res.stdout, (
181-
"autocomplete function could not complete <file> " "after options in command"
182-
)
183-
assert os.path.join("resources", "") in res.stdout, (
184-
"autocomplete function could not complete <dir> " "after options in command"
185-
)
180+
assert (
181+
"requirements.txt" in res.stdout
182+
), "autocomplete function could not complete <file> after options in command"
183+
assert (
184+
os.path.join("resources", "") in res.stdout
185+
), "autocomplete function could not complete <dir> after options in command"
186186
assert not any(
187187
out in res.stdout for out in (os.path.join("REPLAY", ""), "README.txt")
188188
), (
@@ -191,12 +191,12 @@ def test_completion_files_after_option(autocomplete, data):
191191
)
192192
if sys.platform != "win32":
193193
return
194-
assert "readme.txt" in res.stdout, (
195-
"autocomplete function could not complete <file> " "after options in command"
196-
)
197-
assert os.path.join("replay", "") in res.stdout, (
198-
"autocomplete function could not complete <dir> " "after options in command"
199-
)
194+
assert (
195+
"readme.txt" in res.stdout
196+
), "autocomplete function could not complete <file> after options in command"
197+
assert (
198+
os.path.join("replay", "") in res.stdout
199+
), "autocomplete function could not complete <dir> after options in command"
200200

201201

202202
def test_completion_not_files_after_option(autocomplete, data):
@@ -209,12 +209,16 @@ def test_completion_not_files_after_option(autocomplete, data):
209209
cword="2",
210210
cwd=data.completion_paths,
211211
)
212-
assert not any(out in res.stdout for out in ("requirements.txt", "readme.txt",)), (
213-
"autocomplete function completed <file> when " "it should not complete"
214-
)
212+
assert not any(
213+
out in res.stdout
214+
for out in (
215+
"requirements.txt",
216+
"readme.txt",
217+
)
218+
), "autocomplete function completed <file> when it should not complete"
215219
assert not any(
216220
os.path.join(out, "") in res.stdout for out in ("replay", "resources")
217-
), ("autocomplete function completed <dir> when " "it should not complete")
221+
), "autocomplete function completed <dir> when it should not complete"
218222

219223

220224
@pytest.mark.parametrize("cl_opts", ["-U", "--user", "-h"])
@@ -228,12 +232,16 @@ def test_completion_not_files_after_nonexpecting_option(autocomplete, data, cl_o
228232
cword="2",
229233
cwd=data.completion_paths,
230234
)
231-
assert not any(out in res.stdout for out in ("requirements.txt", "readme.txt",)), (
232-
"autocomplete function completed <file> when " "it should not complete"
233-
)
235+
assert not any(
236+
out in res.stdout
237+
for out in (
238+
"requirements.txt",
239+
"readme.txt",
240+
)
241+
), "autocomplete function completed <file> when it should not complete"
234242
assert not any(
235243
os.path.join(out, "") in res.stdout for out in ("replay", "resources")
236-
), ("autocomplete function completed <dir> when " "it should not complete")
244+
), "autocomplete function completed <dir> when it should not complete"
237245

238246

239247
def test_completion_directories_after_option(autocomplete, data):
@@ -252,7 +260,7 @@ def test_completion_directories_after_option(autocomplete, data):
252260
assert not any(
253261
out in res.stdout
254262
for out in ("requirements.txt", "README.txt", os.path.join("REPLAY", ""))
255-
), ("autocomplete function completed <dir> when " "it should not complete")
263+
), "autocomplete function completed <dir> when it should not complete"
256264
if sys.platform == "win32":
257265
assert (
258266
os.path.join("replay", "") in res.stdout

tests/functional/test_freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ def test_freeze_with_requirement_option_package_repeated_multi_file(script):
834834
"Requirement file [hint2.txt] contains NoExist, but package "
835835
"'NoExist' is not installed\n"
836836
)
837-
err2 = "Requirement simple included multiple times " "[hint1.txt, hint2.txt]\n"
837+
err2 = "Requirement simple included multiple times [hint1.txt, hint2.txt]\n"
838838
assert err1 in result.stderr
839839
assert err2 in result.stderr
840840
# there shouldn't be any other 'is not installed' warnings

tests/functional/test_install.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,9 +1615,7 @@ def test_double_install_fail(script, resolver_variant):
16151615
expect_error=(resolver_variant == "legacy"),
16161616
)
16171617
if resolver_variant == "legacy":
1618-
msg = (
1619-
"Double requirement given: pip==7.1.2 (already in pip==7.*, " "name='pip')"
1620-
)
1618+
msg = "Double requirement given: pip==7.1.2 (already in pip==7.*, name='pip')"
16211619
assert msg in result.stderr
16221620

16231621

@@ -1939,7 +1937,7 @@ def test_invalid_index_url_argument(script, shared_data):
19391937
)
19401938

19411939
assert (
1942-
'WARNING: The index url "--user" seems invalid, ' "please provide a scheme."
1940+
'WARNING: The index url "--user" seems invalid, please provide a scheme.'
19431941
) in result.stderr, str(result)
19441942

19451943

0 commit comments

Comments
 (0)