This commit is contained in:
Shantanu 2023-11-29 21:40:19 +08:00 committed by GitHub
commit db8bb13979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -10,9 +10,6 @@ for sub-dependencies
a. "first found, wins" (where the order is breadth first) a. "first found, wins" (where the order is breadth first)
""" """
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import logging import logging
import sys import sys
from collections import defaultdict from collections import defaultdict
@ -323,6 +320,7 @@ class Resolver(BaseResolver):
""" """
# Don't uninstall the conflict if doing a user install and the # Don't uninstall the conflict if doing a user install and the
# conflict is not a user install. # conflict is not a user install.
assert req.satisfied_by is not None
if not self.use_user_site or req.satisfied_by.in_usersite: if not self.use_user_site or req.satisfied_by.in_usersite:
req.should_reinstall = True req.should_reinstall = True
req.satisfied_by = None req.satisfied_by = None
@ -421,6 +419,8 @@ class Resolver(BaseResolver):
if self.wheel_cache is None or self.preparer.require_hashes: if self.wheel_cache is None or self.preparer.require_hashes:
return return
assert req.link is not None, "_find_requirement_link unexpectedly returned None"
cache_entry = self.wheel_cache.get_cache_entry( cache_entry = self.wheel_cache.get_cache_entry(
link=req.link, link=req.link,
package_name=req.name, package_name=req.name,
@ -534,6 +534,7 @@ class Resolver(BaseResolver):
with indent_log(): with indent_log():
# We add req_to_install before its dependencies, so that we # We add req_to_install before its dependencies, so that we
# can refer to it when adding dependencies. # can refer to it when adding dependencies.
assert req_to_install.name is not None
if not requirement_set.has_requirement(req_to_install.name): if not requirement_set.has_requirement(req_to_install.name):
# 'unnamed' requirements will get added here # 'unnamed' requirements will get added here
# 'unnamed' requirements can only come from being directly # 'unnamed' requirements can only come from being directly
@ -589,7 +590,7 @@ class Resolver(BaseResolver):
if req.constraint: if req.constraint:
return return
ordered_reqs.add(req) ordered_reqs.add(req)
for dep in self._discovered_dependencies[req.name]: for dep in self._discovered_dependencies[req.name]: # type: ignore[index]
schedule(dep) schedule(dep)
order.append(req) order.append(req)