Replacing deprecated has_key() with operator in (PEP8)

This commit is contained in:
Miroslav Stampar
2013-01-03 23:28:07 +01:00
parent e4a3c015e5
commit 1712603dce
5 changed files with 7 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ def hexencode(value):
return utf8encode(value).encode("hex")
def md5hash(value):
if sys.modules.has_key('hashlib'):
if "hashlib" in sys.modules:
return hashlib.md5(value).hexdigest()
else:
return md5.new(value).hexdigest()
@@ -60,7 +60,7 @@ def ordencode(value):
return tuple(ord(char) for char in value)
def sha1hash(value):
if sys.modules.has_key('hashlib'):
if "hashlib" in sys.modules:
return hashlib.sha1(value).hexdigest()
else:
return sha.new(value).hexdigest()

View File

@@ -47,11 +47,11 @@ class AttribDict(dict):
"""
# This test allows attributes to be set in the __init__ method
if not self.__dict__.has_key('_AttribDict__initialised'):
if "_AttribDict__initialised" not in self.__dict__:
return dict.__setattr__(self, item, value)
# Any normal attributes are handled normally
elif self.__dict__.has_key(item):
elif item in self.__dict__:
dict.__setattr__(self, item, value)
else: