Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into ghpython-93259/from-name-arg-validation-simple
  • Loading branch information
jaraco authored Jun 25, 2022
commit c96dc1e77f032315bfc78f0c1d13c9a61fb68c3f
9 changes: 3 additions & 6 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,9 @@ def from_name(cls, name: str):
"""
if not name:
raise ValueError("A distribution name is required.")
for resolver in cls._discover_resolvers():
dists = resolver(DistributionFinder.Context(name=name))
dist = next(iter(dists), None)
if dist is not None:
return dist
else:
try:
return next(cls.discover(name=name))
except StopIteration:
raise PackageNotFoundError(name)

@classmethod
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.