From 5314e5779d2ab9ce808f4e3949262c92cb4688cd Mon Sep 17 00:00:00 2001 From: Devesh Kumar Singh Date: Tue, 14 Apr 2020 16:44:41 +0530 Subject: [PATCH] Add type for latest_info and fix return type for iter_packages_latest_infos --- src/pip/_internal/commands/list.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pip/_internal/commands/list.py b/src/pip/_internal/commands/list.py index 7a0de088da3..4d68af1f240 100644 --- a/src/pip/_internal/commands/list.py +++ b/src/pip/_internal/commands/list.py @@ -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 @@ -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: