Skip to content

Commit bf43585

Browse files
committed
Prefer functional approach, avoiding any locals.
1 parent a38315d commit bf43585

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

importlib_metadata/__init__.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -295,22 +295,15 @@ def wrapped(self, *args, **kwargs):
295295
self._warn()
296296
return getattr(super(), method_name)(*args, **kwargs)
297297

298-
return wrapped
299-
300-
for method_name in [
301-
'__setitem__',
302-
'__delitem__',
303-
'append',
304-
'reverse',
305-
'extend',
306-
'pop',
307-
'remove',
308-
'__iadd__',
309-
'insert',
310-
'sort',
311-
]:
312-
locals()[method_name] = _wrap_deprecated_method(method_name)
313-
del method_name
298+
return method_name, wrapped
299+
300+
locals().update(
301+
map(
302+
_wrap_deprecated_method,
303+
'__setitem__ __delitem__ append reverse extend pop remove '
304+
'__iadd__ insert sort'.split(),
305+
)
306+
)
314307

315308
def __add__(self, other):
316309
if not isinstance(other, tuple):

0 commit comments

Comments
 (0)