mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Replace dict.has_key with the 'in' operator
The deprecated has_key method will be removed from dicts in Python 3. For custom dict-like classes, has_key() is kept on Python 2, but disabled for Python 3. Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
committed by
Tomas Babej
parent
8b88caa110
commit
6a741b51da
@@ -370,10 +370,10 @@ class StateFile:
|
||||
|
||||
self._load()
|
||||
|
||||
if not self.modules.has_key(module):
|
||||
if module not in self.modules:
|
||||
self.modules[module] = {}
|
||||
|
||||
if not self.modules.has_key(key):
|
||||
if key not in self.modules:
|
||||
self.modules[module][key] = value
|
||||
|
||||
self.save()
|
||||
@@ -387,7 +387,7 @@ class StateFile:
|
||||
"""
|
||||
self._load()
|
||||
|
||||
if not self.modules.has_key(module):
|
||||
if module not in self.modules:
|
||||
return None
|
||||
|
||||
return self.modules[module].get(key, None)
|
||||
@@ -429,7 +429,7 @@ class StateFile:
|
||||
Can be used to determine if a service is configured.
|
||||
"""
|
||||
|
||||
if self.modules.has_key(module):
|
||||
if module in self.modules:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user