Skip to content

Commit f52757d

Browse files
committed
In Distribution.from_name, re-use discover.
1 parent 344a6ff commit f52757d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

importlib_metadata/__init__.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,8 @@ def from_name(cls, name):
557557
:raises PackageNotFoundError: When the named package's distribution
558558
metadata cannot be found.
559559
"""
560-
dists = itertools.chain.from_iterable(
561-
resolver(DistributionFinder.Context(name=name))
562-
for resolver in cls._discover_resolvers()
563-
)
564560
try:
565-
return next(dists)
561+
return next(cls.discover(name=name))
566562
except StopIteration:
567563
raise PackageNotFoundError(name)
568564

0 commit comments

Comments
 (0)