Skip to content

Commit

Permalink
In Distribution.from_name, re-use discover.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 25, 2022
1 parent 344a6ff commit f52757d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,8 @@ def from_name(cls, name):
:raises PackageNotFoundError: When the named package's distribution
metadata cannot be found.
"""
dists = itertools.chain.from_iterable(
resolver(DistributionFinder.Context(name=name))
for resolver in cls._discover_resolvers()
)
try:
return next(dists)
return next(cls.discover(name=name))
except StopIteration:
raise PackageNotFoundError(name)

Expand Down

0 comments on commit f52757d

Please sign in to comment.