Skip to content

Commit 47544ce

Browse files
committed
Remove DeprecatedList
1 parent 7e5bae4 commit 47544ce

File tree

1 file changed

+1
-94
lines changed

1 file changed

+1
-94
lines changed

importlib_metadata/__init__.py

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -209,100 +209,7 @@ def matches(self, **params):
209209
return all(map(operator.eq, params.values(), attrs))
210210

211211

212-
class DeprecatedList(list):
213-
"""
214-
Allow an otherwise immutable object to implement mutability
215-
for compatibility.
216-
217-
>>> recwarn = getfixture('recwarn')
218-
>>> dl = DeprecatedList(range(3))
219-
>>> dl[0] = 1
220-
>>> dl.append(3)
221-
>>> del dl[3]
222-
>>> dl.reverse()
223-
>>> dl.sort()
224-
>>> dl.extend([4])
225-
>>> dl.pop(-1)
226-
4
227-
>>> dl.remove(1)
228-
>>> dl += [5]
229-
>>> dl + [6]
230-
[1, 2, 5, 6]
231-
>>> dl + (6,)
232-
[1, 2, 5, 6]
233-
>>> dl.insert(0, 0)
234-
>>> dl
235-
[0, 1, 2, 5]
236-
>>> dl == [0, 1, 2, 5]
237-
True
238-
>>> dl == (0, 1, 2, 5)
239-
True
240-
>>> len(recwarn)
241-
1
242-
"""
243-
244-
_warn = functools.partial(
245-
warnings.warn,
246-
"EntryPoints list interface is deprecated. Cast to list if needed.",
247-
DeprecationWarning,
248-
stacklevel=2,
249-
)
250-
251-
def __setitem__(self, *args, **kwargs):
252-
self._warn()
253-
return super().__setitem__(*args, **kwargs)
254-
255-
def __delitem__(self, *args, **kwargs):
256-
self._warn()
257-
return super().__delitem__(*args, **kwargs)
258-
259-
def append(self, *args, **kwargs):
260-
self._warn()
261-
return super().append(*args, **kwargs)
262-
263-
def reverse(self, *args, **kwargs):
264-
self._warn()
265-
return super().reverse(*args, **kwargs)
266-
267-
def extend(self, *args, **kwargs):
268-
self._warn()
269-
return super().extend(*args, **kwargs)
270-
271-
def pop(self, *args, **kwargs):
272-
self._warn()
273-
return super().pop(*args, **kwargs)
274-
275-
def remove(self, *args, **kwargs):
276-
self._warn()
277-
return super().remove(*args, **kwargs)
278-
279-
def __iadd__(self, *args, **kwargs):
280-
self._warn()
281-
return super().__iadd__(*args, **kwargs)
282-
283-
def __add__(self, other):
284-
if not isinstance(other, tuple):
285-
self._warn()
286-
other = tuple(other)
287-
return self.__class__(tuple(self) + other)
288-
289-
def insert(self, *args, **kwargs):
290-
self._warn()
291-
return super().insert(*args, **kwargs)
292-
293-
def sort(self, *args, **kwargs):
294-
self._warn()
295-
return super().sort(*args, **kwargs)
296-
297-
def __eq__(self, other):
298-
if not isinstance(other, tuple):
299-
self._warn()
300-
other = tuple(other)
301-
302-
return tuple(self).__eq__(other)
303-
304-
305-
class EntryPoints(DeprecatedList):
212+
class EntryPoints(tuple):
306213
"""
307214
An immutable collection of selectable EntryPoint objects.
308215
"""

0 commit comments

Comments
 (0)