Skip to content

Commit 206fe3c

Browse files
committed
Merge branch 'housekeeping/98-remove-shim' into 'master'
Remove beta compatibility shim Closes #98 See merge request python-devs/importlib_metadata!95
2 parents c854e9a + dd3b031 commit 206fe3c

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-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

importlib_metadata/docs/changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
v1.0.0
66
======
7+
8+
* Removed compatibility shim introduced in 0.23.
9+
710
* For better compatibility with the stdlib implementation and to
811
avoid the same distributions being discovered by the stdlib and
912
backport implementations, the backport now disables the

0 commit comments

Comments
 (0)