Skip to content

Commit

Permalink
Also deprecate iter, contains, keys, and values
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 4, 2021
1 parent 537c55d commit 1f2a89c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ class DeprecatedDict(dict):
>>> dd.get('baz', None)
>>> dd['foo']
'bar'
>>> list(dd)
['foo']
>>> list(dd.keys())
['foo']
>>> 'foo' in dd
True
>>> list(dd.values())
['bar']
>>> len(recwarn)
1
"""
Expand All @@ -266,6 +274,22 @@ def get(self, name, default=None):
self._warn()
return super().get(name, default)

def __iter__(self):
self._warn()
return super().__iter__()

def __contains__(self, *args):
self._warn()
return super().__contains__(*args)

def keys(self):
self._warn()
return super().keys()

def values(self):
self._warn()
return super().values()


class PackagePath(pathlib.PurePosixPath):
"""A reference to a path in a package"""
Expand Down

0 comments on commit 1f2a89c

Please sign in to comment.