@@ -500,7 +500,17 @@ def make_found_candidates(
500
500
prereleases = allow_prereleases ,
501
501
)
502
502
}
503
- return FoundCandidates (candidates , versions = versions , evaluator = self )
503
+
504
+ # Again, converting version to str to deal with debundling.
505
+ applicable_candidates = [
506
+ c for c in candidates if str (c .version ) in versions
507
+ ]
508
+
509
+ return FoundCandidates (
510
+ candidates ,
511
+ applicable_candidates = applicable_candidates ,
512
+ evaluator = self ,
513
+ )
504
514
505
515
def _sort_key (self , candidate ):
506
516
# type: (InstallationCandidate) -> CandidateSortingKey
@@ -594,21 +604,20 @@ class FoundCandidates(object):
594
604
595
605
def __init__ (
596
606
self ,
597
- candidates , # type: List[InstallationCandidate]
598
- versions , # type: Set[str ]
599
- evaluator , # type: CandidateEvaluator
607
+ candidates , # type: List[InstallationCandidate]
608
+ applicable_candidates , # type: List[InstallationCandidate ]
609
+ evaluator , # type: CandidateEvaluator
600
610
):
601
611
# type: (...) -> None
602
612
"""
603
613
:param candidates: A sequence of all available candidates found.
604
- :param versions: The applicable versions to filter applicable
605
- candidates.
614
+ :param applicable_candidates: The applicable candidates.
606
615
:param evaluator: A CandidateEvaluator object to sort applicable
607
616
candidates by order of preference.
608
617
"""
618
+ self ._applicable_candidates = applicable_candidates
609
619
self ._candidates = candidates
610
620
self ._evaluator = evaluator
611
- self ._versions = versions
612
621
613
622
def iter_all (self ):
614
623
# type: () -> Iterable[InstallationCandidate]
@@ -618,11 +627,9 @@ def iter_all(self):
618
627
619
628
def iter_applicable (self ):
620
629
# type: () -> Iterable[InstallationCandidate]
621
- """Iterate through candidates matching the versions associated with
622
- this instance.
630
+ """Iterate through the applicable candidates.
623
631
"""
624
- # Again, converting version to str to deal with debundling.
625
- return (c for c in self .iter_all () if str (c .version ) in self ._versions )
632
+ return iter (self ._applicable_candidates )
626
633
627
634
def get_best (self ):
628
635
# type: () -> Optional[InstallationCandidate]
0 commit comments