1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Merge spec->req constructors

Since both functions now return Optional[Requirement], we can just use
the same implementation.
This commit is contained in:
Tzu-ping Chung 2020-06-02 11:59:03 +08:00
parent d5204dd0ba
commit 1719fc3dcc
2 changed files with 2 additions and 7 deletions

View file

@ -445,7 +445,7 @@ class ExtrasCandidate(Candidate):
yield factory.make_requirement_from_candidate(self.base)
for r in self.base.dist.requires(valid_extras):
requirement = factory.make_requirement_from_spec_matching_extras(
requirement = factory.make_requirement_from_spec(
str(r), self.base._ireq, valid_extras,
)
if requirement:

View file

@ -256,12 +256,7 @@ class Factory(object):
# type: (Candidate) -> ExplicitRequirement
return ExplicitRequirement(candidate)
def make_requirement_from_spec(self, specifier, comes_from):
# type: (str, InstallRequirement) -> Requirement
ireq = self._make_install_req_from_spec(specifier, comes_from)
return self.make_requirement_from_install_req(ireq, ())
def make_requirement_from_spec_matching_extras(
def make_requirement_from_spec(
self,
specifier, # type: str
comes_from, # type: InstallRequirement