Skip to content

Commit 257a387

Browse files
committed
Revert "Add compatibility shim to prevent exception on select Python versions." Closes #98
This reverts commit 06b8e26.
1 parent 08a3782 commit 257a387

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

importlib_metadata/__init__.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ def from_name(cls, name):
178178
metadata cannot be found.
179179
"""
180180
for resolver in cls._discover_resolvers():
181-
context = DistributionFinder.Context(name=name)
182-
dists = cls._maybe_bind(resolver, context)
181+
dists = resolver(DistributionFinder.Context(name=name))
183182
dist = next(dists, None)
184183
if dist is not None:
185184
return dist
@@ -201,24 +200,10 @@ def discover(cls, **kwargs):
201200
raise ValueError("cannot accept context and kwargs")
202201
context = context or DistributionFinder.Context(**kwargs)
203202
return itertools.chain.from_iterable(
204-
cls._maybe_bind(resolver, context)
203+
resolver(context)
205204
for resolver in cls._discover_resolvers()
206205
)
207206

208-
@staticmethod
209-
def _maybe_bind(resolver, context):
210-
"""
211-
Only bind the context to the resolver if as a callable,
212-
the resolver accepts the context parameter.
213-
214-
Workaround for
215-
https://gitlab.com/python-devs/importlib_metadata/issues/86
216-
"""
217-
try: # pragma: nocover
218-
return resolver(context)
219-
except TypeError: # pragma: nocover
220-
return resolver(name=context.name, path=context.path)
221-
222207
@staticmethod
223208
def at(path):
224209
"""Return a Distribution for the indicated metadata path

0 commit comments

Comments
 (0)