Skip to content

Commit

Permalink
Add type for latest_info and fix return type for iter_packages_latest…
Browse files Browse the repository at this point in the history
…_infos
  • Loading branch information
deveshks committed Apr 19, 2020
1 parent 02b3c68 commit 5314e57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pip/_internal/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

if MYPY_CHECK_RUNNING:
from optparse import Values
from typing import Any, List, Set, Tuple
from typing import Any, List, Set, Tuple, Iterator

from pip._internal.network.session import PipSession
from pip._vendor.pkg_resources import Distribution
Expand Down Expand Up @@ -199,11 +199,12 @@ def get_not_required(self, packages, options):
return list({pkg for pkg in packages if pkg.key not in dep_keys})

def iter_packages_latest_infos(self, packages, options):
# type: (List[Distribution], Values) -> Distribution
# type: (List[Distribution], Values) -> Iterator[Distribution]
with self._build_session(options) as session:
finder = self._build_package_finder(options, session)

def latest_info(dist):
# type: (Distribution) -> Distribution
typ = 'unknown'
all_candidates = finder.find_all_candidates(dist.key)
if not options.pre:
Expand Down

0 comments on commit 5314e57

Please sign in to comment.