Skip to content

Commit 9fb1f5b

Browse files
authored
Merge pull request #11128 from huguesb/speedup-slow-support-index-min
2 parents f1a5cfc + 1d19c27 commit 9fb1f5b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

news/4C988F0E-6A4D-45CE-A60F-9E86DB494FBF.trivial.rst

Whitespace-only changes.

src/pip/_internal/models/wheel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def support_index_min(self, tags: List[Tag]) -> int:
5858
:raises ValueError: If none of the wheel's file tags match one of
5959
the supported tags.
6060
"""
61-
return min(tags.index(tag) for tag in self.file_tags if tag in tags)
61+
try:
62+
return next(i for i, t in enumerate(tags) if t in self.file_tags)
63+
except StopIteration:
64+
raise ValueError()
6265

6366
def find_most_preferred_tag(
6467
self, tags: List[Tag], tag_to_priority: Dict[Tag, int]

0 commit comments

Comments
 (0)