mirror of
https://github.com/python/cpython.git
synced 2025-12-11 03:20:01 +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)
|
return len(self.dict)
|
||||||
|
|
||||||
def has_key(self, key):
|
def has_key(self, key):
|
||||||
return self.dict.has_key(key)
|
return key in self.dict
|
||||||
|
|
||||||
def __contains__(self, key):
|
def __contains__(self, key):
|
||||||
return self.dict.has_key(key)
|
return key in self.dict
|
||||||
|
|
||||||
def get(self, key, default=None):
|
def get(self, key, default=None):
|
||||||
if self.dict.has_key(key):
|
if key in self.dict:
|
||||||
return self[key]
|
return self[key]
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue