Skip to content

Commit 47b14ac

Browse files
committed
Make MetadataPathFinder.find_distributions a classmethod for consistency with CPython. Closes #484.
1 parent adc4b12 commit 47b14ac

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

importlib_metadata/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,9 @@ class MetadataPathFinder(NullFinder, DistributionFinder):
877877
of Python that do not have a PathFinder find_distributions().
878878
"""
879879

880+
@classmethod
880881
def find_distributions(
881-
self, context=DistributionFinder.Context()
882+
cls, context=DistributionFinder.Context()
882883
) -> Iterable[PathDistribution]:
883884
"""
884885
Find distributions.
@@ -888,7 +889,7 @@ def find_distributions(
888889
(or all names if ``None`` indicated) along the paths in the list
889890
of directories ``context.path``.
890891
"""
891-
found = self._search_paths(context.name, context.path)
892+
found = cls._search_paths(context.name, context.path)
892893
return map(PathDistribution, found)
893894

894895
@classmethod

newsfragments/484.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make MetadataPathFinder.find_distributions a classmethod for consistency with CPython. Closes #484.

0 commit comments

Comments
 (0)