Skip to content

Commit 153e22a

Browse files
authored
Merge pull request #7614 from deepak1725/string-formatting
Updated string formatting
2 parents 87fa5ce + b242c39 commit 153e22a

File tree

7 files changed

+30
-28
lines changed

7 files changed

+30
-28
lines changed

news/c11aae95-1bc6-4a32-b005-65d0a7843207.trivial

Whitespace-only changes.

src/pip/_internal/req/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,18 @@ def install_given_reqs(
4848
"""
4949

5050
if to_install:
51-
logger.info(
52-
'Installing collected packages: %s',
53-
', '.join([req.name for req in to_install]),
51+
msg = 'Installing collected packages: {}'.format(
52+
', '.join([req.name for req in to_install])
5453
)
54+
logger.info(msg)
5555

5656
installed = []
5757

5858
with indent_log():
5959
for requirement in to_install:
6060
if requirement.should_reinstall:
61-
logger.info('Attempting uninstall: %s', requirement.name)
61+
logger.info('Attempting uninstall: {}'.format(
62+
requirement.name))
6263
with indent_log():
6364
uninstalled_pathset = requirement.uninstall(
6465
auto_confirm=True

src/pip/_internal/req/req_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def get_requirement_tracker():
6060
TempDirectory(kind='req-tracker')
6161
).path
6262
ctx.enter_context(update_env_context_manager(PIP_REQ_TRACKER=root))
63-
logger.debug("Initialized build tracking at %s", root)
63+
logger.debug("Initialized build tracking at {}".format(root))
6464

6565
with RequirementTracker(root) as tracker:
6666
yield tracker

tests/functional/test_install_cleanup.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ def test_cleanup_after_install(script, data):
1414
Test clean up after installing a package.
1515
"""
1616
script.pip(
17-
'install', '--no-index', '--find-links=%s' % data.find_links, 'simple'
17+
'install', '--no-index',
18+
'--find-links={}'.format(data.find_links),
19+
'simple'
1820
)
1921
build = script.venv_path / "build"
2022
src = script.venv_path / "src"
21-
assert not exists(build), "build/ dir still exists: %s" % build
22-
assert not exists(src), "unexpected src/ dir exists: %s" % src
23+
assert not exists(build), "build/ dir still exists: {}".format(build)
24+
assert not exists(src), "unexpected src/ dir exists: {}" .format(src)
2325
script.assert_no_temp()
2426

2527

@@ -31,7 +33,7 @@ def test_no_clean_option_blocks_cleaning_after_install(script, data):
3133
build = script.base_path / 'pip-build'
3234
script.pip(
3335
'install', '--no-clean', '--no-index', '--build', build,
34-
'--find-links=%s' % data.find_links, 'simple', expect_temp=True,
36+
'--find-links={}'.format(data.find_links), 'simple', expect_temp=True,
3537
)
3638
assert exists(build)
3739

@@ -43,16 +45,14 @@ def test_cleanup_after_install_editable_from_hg(script, tmpdir):
4345
Test clean up after cloning from Mercurial.
4446
4547
"""
46-
script.pip(
47-
'install',
48-
'-e',
49-
'%s#egg=ScriptTest' %
50-
local_checkout('hg+https://bitbucket.org/ianb/scripttest', tmpdir),
48+
requirement = '{}#egg=ScriptTest'.format(
49+
local_checkout('hg+https://bitbucket.org/ianb/scripttest', tmpdir)
5150
)
51+
script.pip('install', '-e', requirement)
5252
build = script.venv_path / 'build'
5353
src = script.venv_path / 'src'
54-
assert not exists(build), "build/ dir still exists: %s" % build
55-
assert exists(src), "expected src/ dir doesn't exist: %s" % src
54+
assert not exists(build), "build/ dir still exists: {}".format(build)
55+
assert exists(src), "expected src/ dir doesn't exist: {}".format(src)
5656
script.assert_no_temp()
5757

5858

@@ -64,8 +64,8 @@ def test_cleanup_after_install_from_local_directory(script, data):
6464
script.pip('install', to_install)
6565
build = script.venv_path / 'build'
6666
src = script.venv_path / 'src'
67-
assert not exists(build), "unexpected build/ dir exists: %s" % build
68-
assert not exists(src), "unexpected src/ dir exist: %s" % src
67+
assert not exists(build), "unexpected build/ dir exists: {}".format(build)
68+
assert not exists(src), "unexpected src/ dir exist: {}".format(src)
6969
script.assert_no_temp()
7070

7171

tests/functional/test_install_index.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_find_links_relative_path(script, data):
1717
cwd=data.root,
1818
)
1919
egg_info_folder = (
20-
script.site_packages / 'parent-0.1-py%s.egg-info' % pyversion
20+
script.site_packages / 'parent-0.1-py{}.egg-info'.format(pyversion)
2121
)
2222
initools_folder = script.site_packages / 'parent'
2323
assert egg_info_folder in result.files_created, str(result)
@@ -28,17 +28,17 @@ def test_find_links_requirements_file_relative_path(script, data):
2828
"""Test find-links as a relative path to a reqs file."""
2929
script.scratch_path.joinpath("test-req.txt").write_text(textwrap.dedent("""
3030
--no-index
31-
--find-links=%s
31+
--find-links={}
3232
parent==0.1
33-
""" % data.packages.replace(os.path.sep, '/')))
33+
""" .format(data.packages.replace(os.path.sep, '/'))))
3434
result = script.pip(
3535
'install',
3636
'-r',
3737
script.scratch_path / "test-req.txt",
3838
cwd=data.root,
3939
)
4040
egg_info_folder = (
41-
script.site_packages / 'parent-0.1-py%s.egg-info' % pyversion
41+
script.site_packages / 'parent-0.1-py{}.egg-info'.format(pyversion)
4242
)
4343
initools_folder = script.site_packages / 'parent'
4444
assert egg_info_folder in result.files_created, str(result)
@@ -52,7 +52,7 @@ def test_install_from_file_index_hash_link(script, data):
5252
"""
5353
result = script.pip('install', '-i', data.index_url(), 'simple==1.0')
5454
egg_info_folder = (
55-
script.site_packages / 'simple-1.0-py%s.egg-info' % pyversion
55+
script.site_packages / 'simple-1.0-py{}.egg-info'.format(pyversion)
5656
)
5757
assert egg_info_folder in result.files_created, str(result)
5858

@@ -69,5 +69,5 @@ def test_file_index_url_quoting(script, data):
6969
str(result.stdout)
7070
)
7171
assert (
72-
script.site_packages / 'simple-1.0-py%s.egg-info' % pyversion
72+
script.site_packages / 'simple-1.0-py{}.egg-info'.format(pyversion)
7373
) in result.files_created, str(result)

tests/functional/test_install_reqs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ def test_requirements_file(script):
3030
'install', '-r', script.scratch_path / 'initools-req.txt'
3131
)
3232
assert (
33-
script.site_packages / 'INITools-0.2-py%s.egg-info' %
34-
pyversion in result.files_created
33+
script.site_packages / 'INITools-0.2-py{}.egg-info'.format(
34+
pyversion in result.files_created)
3535
)
3636
assert script.site_packages / 'initools' in result.files_created
3737
assert result.files_created[script.site_packages / other_lib_name].dir
38-
fn = '%s-%s-py%s.egg-info' % (other_lib_name, other_lib_version, pyversion)
38+
fn = '{}-{}-py{}.egg-info'.format(
39+
other_lib_name, other_lib_version, pyversion)
3940
assert result.files_created[script.site_packages / fn].dir
4041

4142

tests/functional/test_show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_basic_show(script):
1515
lines = result.stdout.splitlines()
1616
assert len(lines) == 10
1717
assert 'Name: pip' in lines
18-
assert 'Version: %s' % __version__ in lines
18+
assert 'Version: {}'.format(__version__) in lines
1919
assert any(line.startswith('Location: ') for line in lines)
2020
assert 'Requires: ' in lines
2121

0 commit comments

Comments
 (0)