Skip to content

Commit 3559ff9

Browse files
author
bmartinn
committed
mypy
1 parent f850eee commit 3559ff9

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/pip/_internal/req/__init__.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def install_given_reqs(
6060
)
6161

6262
# pre allocate installed package names
63-
installed = [None] * len(to_install) # type: List[Any]
63+
installed = \
64+
[None] * len(to_install) # type: List[Optional[InstallationResult]]
6465

6566
install_args = [install_options, global_options, args, kwargs]
6667

@@ -92,7 +93,7 @@ def install_given_reqs(
9293

9394
def __single_install(
9495
install_args, # type: List[Any]
95-
a_requirement, # type: InstallRequirement
96+
requirement, # type: InstallRequirement
9697
allow_raise=False # type: bool
9798
):
9899
# type: (...) -> Optional[InstallationResult]
@@ -101,32 +102,32 @@ def __single_install(
101102
102103
(to be called per requirement, either in parallel or serially)
103104
"""
104-
if a_requirement.should_reinstall:
105-
logger.info('Attempting uninstall: %s', a_requirement.name)
105+
if requirement.should_reinstall:
106+
logger.info('Attempting uninstall: %s', requirement.name)
106107
with indent_log():
107-
uninstalled_pathset = a_requirement.uninstall(
108+
uninstalled_pathset = requirement.uninstall(
108109
auto_confirm=True
109110
)
110111
try:
111-
a_requirement.install(
112+
requirement.install(
112113
install_args[0], # install_options,
113114
install_args[1], # global_options,
114115
*install_args[2], # *args,
115116
**install_args[3] # **kwargs
116117
)
117118
except Exception:
118-
should_rollback = (a_requirement.should_reinstall and
119-
not a_requirement.install_succeeded)
119+
should_rollback = (requirement.should_reinstall and
120+
not requirement.install_succeeded)
120121
# if install did not succeed, rollback previous uninstall
121122
if should_rollback:
122123
uninstalled_pathset.rollback()
123124
if allow_raise:
124125
raise
125126
else:
126-
should_commit = (a_requirement.should_reinstall and
127-
a_requirement.install_succeeded)
127+
should_commit = (requirement.should_reinstall and
128+
requirement.install_succeeded)
128129
if should_commit:
129130
uninstalled_pathset.commit()
130-
return InstallationResult(a_requirement.name)
131+
return InstallationResult(requirement.name)
131132

132133
return None

0 commit comments

Comments
 (0)