Skip to content

Commit

Permalink
Silence W601 .has_key() is deprecated
Browse files Browse the repository at this point in the history
Related: https://pagure.io/freeipa/issue/8306
Signed-off-by: Christian Heimes <[email protected]>
Reviewed-By: Florence Blanc-Renaud <[email protected]>
  • Loading branch information
tiran committed May 5, 2020
1 parent 186d739 commit c544d18
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ipapython/ipautil.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def __contains__(self, key):
if six.PY2:
def has_key(self, key):
# pylint: disable=no-member
return super(CIDict, self).has_key(key.lower())
return super(CIDict, self).has_key(key.lower()) # noqa
# pylint: enable=no-member

def get(self, key, failobj=None):
Expand Down
8 changes: 4 additions & 4 deletions ipatests/test_ipapython/test_ipautil.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ def test_copy(self):

@pytest.mark.skipif(not six.PY2, reason="Python 2 only")
def test_haskey(self):
assert self.cidict.has_key("KEY1")
assert self.cidict.has_key("key2")
assert self.cidict.has_key("key3")
assert self.cidict.has_key("KEY1") # noqa
assert self.cidict.has_key("key2") # noqa
assert self.cidict.has_key("key3") # noqa

assert not self.cidict.has_key("Key4")
assert not self.cidict.has_key("Key4") # noqa

def test_contains(self):
assert "KEY1" in self.cidict
Expand Down
4 changes: 2 additions & 2 deletions ipatests/test_ipapython/test_keyring.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ def test_06(self):
See if a key is available
"""
kernel_keyring.add_key(TEST_KEY, TEST_VALUE)
assert kernel_keyring.has_key(TEST_KEY)
assert kernel_keyring.has_key(TEST_KEY) # noqa

kernel_keyring.del_key(TEST_KEY)
assert not kernel_keyring.has_key(TEST_KEY)
assert not kernel_keyring.has_key(TEST_KEY) # noqa

def test_07(self):
"""
Expand Down
6 changes: 3 additions & 3 deletions ipatests/test_ipaserver/test_ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ def test_clear(self):
@pytest.mark.skipif(sys.version_info >= (3, 0), reason="Python 2 only")
def test_has_key(self):
e = self.entry
assert not e.has_key('xyz')
assert e.has_key('cn')
assert e.has_key('COMMONNAME')
assert not e.has_key('xyz') # noqa
assert e.has_key('cn') # noqa
assert e.has_key('COMMONNAME') # noqa

def test_in(self):
e = self.entry
Expand Down

0 comments on commit c544d18

Please sign in to comment.