Skip to content

Commit 6282a30

Browse files
committed
👹 Feed the hobgoblins (delint).
1 parent 816efa1 commit 6282a30

20 files changed

+104
-62
lines changed

‎src/pip/_internal/cli/progress_bars.py‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,6 @@ class DownloadBlueEmojiProgressBar(BaseDownloadProgressBar, # type: ignore
234234
pass
235235

236236

237-
class ObjectMapAdapter:
238-
"""Translate getitem to getattr."""
239-
240-
def __init__(self, obj):
241-
self.obj = obj
242-
243-
def __getitem__(self, key):
244-
return getattr(self.obj, key)
245-
246-
247237
class DownloadProgressSpinner(WindowsMixin, InterruptibleMixin,
248238
DownloadProgressMixin, Spinner):
249239

@@ -257,9 +247,15 @@ def next_phase(self): # type: ignore
257247

258248
def update(self):
259249
# type: () -> None
260-
message = self.message.format_map(ObjectMapAdapter(self))
250+
vals = dict(
251+
downloaded=self.downloaded,
252+
download_speed=self.download_speed,
253+
pretty_eta=self.pretty_eta,
254+
percent=self.percent,
255+
)
256+
message = self.message.format(**vals)
261257
phase = self.next_phase()
262-
suffix = self.suffix.format_map(ObjectMapAdapter(self))
258+
suffix = self.suffix.format(**vals)
263259
line = " ".join(filter(None, (message, phase, suffix)))
264260
self.writeln(line)
265261

‎src/pip/_internal/cli/req_command.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def get_requirements(
344344
raise CommandError(
345345
'You must give at least one requirement to {name} '
346346
'(maybe you meant "pip {name} {links}"?)'.format(
347-
**dict(opts, links=' '.join(options.find_links))))
347+
**dict(opts, links=' '.join(options.find_links))))
348348
else:
349349
raise CommandError(
350350
'You must give at least one requirement to {name} '

‎src/pip/_internal/cli/spinners.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ def finish(self, final_status):
106106
# type: (str) -> None
107107
if self._finished:
108108
return
109-
self._update("finished with status '{final_status}'".format(**locals()))
109+
self._update(
110+
"finished with status '{final_status}'".format(**locals()))
110111
self._finished = True
111112

112113

‎src/pip/_internal/commands/completion.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def run(self, options, args):
8585
shell_options = ['--' + shell for shell in sorted(shells)]
8686
if options.shell in shells:
8787
script = textwrap.dedent(
88-
COMPLETION_SCRIPTS.get(options.shell, '').format(prog=get_prog())
88+
COMPLETION_SCRIPTS.get(options.shell, '').format(
89+
prog=get_prog())
8990
)
9091
print(BASE_COMPLETION.format(script=script, shell=options.shell))
9192
else:

‎src/pip/_internal/models/link.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def filename(self):
9696
return netloc
9797

9898
name = urllib_parse.unquote(name)
99-
assert name, ('URL {self._url!r} produced no filename'.format(**locals()))
99+
assert name, (
100+
'URL {self._url!r} produced no filename'.format(**locals()))
100101
return name
101102

102103
@property

‎src/pip/_internal/req/req_install.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ def update_editable(self, obtain=True):
639639
if self.link.scheme == 'file':
640640
# Static paths don't get updated
641641
return
642-
assert '+' in self.link.url, "bad url: {self.link.url!r}".format(**locals())
642+
assert '+' in self.link.url, \
643+
"bad url: {self.link.url!r}".format(**locals())
643644
vc_type, url = self.link.url.split('+', 1)
644645
vcs_backend = vcs.get_backend(vc_type)
645646
if vcs_backend:

‎src/pip/_internal/utils/filesystem.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def copy2_fixed(src, dest):
7373
pass
7474
else:
7575
if is_socket_file:
76-
raise shutil.SpecialFileError("`{f}` is a socket".format(**locals()))
76+
raise shutil.SpecialFileError(
77+
"`{f}` is a socket".format(**locals()))
7778

7879
raise
7980

‎src/pip/_internal/utils/urls.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def url_to_path(url):
3434
Convert a file: URL to a path.
3535
"""
3636
assert url.startswith('file:'), (
37-
"You can only turn file: urls into filenames (not {url!r})".format(**locals()))
37+
"You can only turn file: urls into filenames (not {url!r})"
38+
.format(**locals()))
3839

3940
_, netloc, path, _, _ = urllib_parse.urlsplit(url)
4041

‎src/pip/_internal/vcs/subversion.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def _get_svn_url_rev(cls, location):
151151
elif data.startswith('<?xml'):
152152
match = _svn_xml_url_re.search(data)
153153
if not match:
154-
raise ValueError('Badly formatted data: {data!r}'.format(**locals()))
154+
raise ValueError(
155+
'Badly formatted data: {data!r}'.format(**locals()))
155156
url = match.group(1) # get repository URL
156157
revs = [int(m.group(1)) for m in _svn_rev_re.finditer(data)] + [0]
157158
else:

‎tests/conftest.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,13 @@ def not_code_files_and_folders(path, names):
234234

235235

236236
def _common_wheel_editable_install(tmpdir_factory, common_wheels, package):
237-
wheel_candidates = list(common_wheels.glob('{package}-*.whl'.format(**locals())))
237+
wheel_candidates = list(
238+
common_wheels.glob('{package}-*.whl'.format(**locals())))
238239
assert len(wheel_candidates) == 1, wheel_candidates
239240
install_dir = Path(str(tmpdir_factory.mktemp(package))) / 'install'
240241
Wheel(wheel_candidates[0]).install_as_egg(install_dir)
241-
(install_dir / 'EGG-INFO').rename(install_dir / '{package}.egg-info'.format(**locals()))
242+
(install_dir / 'EGG-INFO').rename(
243+
install_dir / '{package}.egg-info'.format(**locals()))
242244
assert compileall.compile_dir(str(install_dir), quiet=1)
243245
return install_dir
244246

0 commit comments

Comments
 (0)