mirror of
https://github.com/python/cpython.git
synced 2025-12-10 02:50:09 +00:00
Remove dict.has_key() usage in the shelve module to silence warnings under -3.
This commit is contained in:
parent
5b3d3729ba
commit
753ecb13db
1 changed files with 3 additions and 3 deletions
|
|
@ -105,13 +105,13 @@ class Shelf(UserDict.DictMixin):
|
|||
return len(self.dict)
|
||||
|
||||
def has_key(self, key):
|
||||
return self.dict.has_key(key)
|
||||
return key in self.dict
|
||||
|
||||
def __contains__(self, key):
|
||||
return self.dict.has_key(key)
|
||||
return key in self.dict
|
||||
|
||||
def get(self, key, default=None):
|
||||
if self.dict.has_key(key):
|
||||
if key in self.dict:
|
||||
return self[key]
|
||||
return default
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue