Skip to content

Commit adf3c9f

Browse files
author
pip
committed
Add clarification on why a set is used in get_not_required
1 parent a4683a5 commit adf3c9f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pip/_internal/commands/list.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,14 @@ def get_not_required(self, packages, options):
190190
dep_keys = set() # type: Set[Distribution]
191191
for dist in packages:
192192
dep_keys.update(requirement.key for requirement in dist.requires())
193+
194+
# Create a set to remove duplicate packages, and cast it to a list
195+
# to keep the return type consistent with get_outdated and
196+
# get_uptodate
193197
return list({pkg for pkg in packages if pkg.key not in dep_keys})
194198

195-
def iter_packages_latest_infos(self, packages, options): # type: ignore
199+
def iter_packages_latest_infos(self, packages, options):
200+
# type: (List[Distribution], Values) -> Distribution
196201
with self._build_session(options) as session:
197202
finder = self._build_package_finder(options, session)
198203

0 commit comments

Comments
 (0)