mirror of https://github.com/pypa/pip
Allow Candidate.iter_dependencies() to yield None
This commit is contained in:
parent
92a687ce66
commit
258bd7945e
|
@ -55,7 +55,7 @@ class Candidate(object):
|
|||
raise NotImplementedError("Override in subclass")
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Requirement]
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
raise NotImplementedError("Override in subclass")
|
||||
|
||||
def get_install_requirement(self):
|
||||
|
|
|
@ -217,7 +217,7 @@ class _InstallRequirementBackedCandidate(Candidate):
|
|||
return spec
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Requirement]
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
for r in self.dist.requires():
|
||||
yield self._factory.make_requirement_from_spec(str(r), self._ireq)
|
||||
python_dep = self._factory.make_requires_python_requirement(
|
||||
|
@ -343,7 +343,7 @@ class AlreadyInstalledCandidate(Candidate):
|
|||
return self.dist.parsed_version
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Requirement]
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
for r in self.dist.requires():
|
||||
yield self._factory.make_requirement_from_spec(str(r), self._ireq)
|
||||
|
||||
|
@ -425,7 +425,7 @@ class ExtrasCandidate(Candidate):
|
|||
return self.base.is_installed
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Requirement]
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
factory = self.base._factory
|
||||
|
||||
# The user may have specified extras that the candidate doesn't
|
||||
|
@ -486,7 +486,7 @@ class RequiresPythonCandidate(Candidate):
|
|||
return self._version
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Requirement]
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
return ()
|
||||
|
||||
def get_install_requirement(self):
|
||||
|
|
|
@ -147,4 +147,4 @@ class PipProvider(AbstractProvider):
|
|||
# type: (Candidate) -> Sequence[Requirement]
|
||||
if self._ignore_dependencies:
|
||||
return []
|
||||
return list(candidate.iter_dependencies())
|
||||
return [r for r in candidate.iter_dependencies() if r is not None]
|
||||
|
|
Loading…
Reference in New Issue