Skip to content

Commit

Permalink
Replacing deprecated has_key() with operator in (PEP8)
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed Jan 3, 2013
1 parent e4a3c01 commit 1712603
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion extra/sqlharvest/sqlharvest.py
Expand Up @@ -92,7 +92,7 @@ def main():
req = urllib2.Request(sqlfile)
response = urllib2.urlopen(req)

if response.headers.has_key("Content-Length"):
if "Content-Length" in response.headers:
if int(response.headers.get("Content-Length")) > MAX_FILE_SIZE:
continue

Expand Down
4 changes: 2 additions & 2 deletions lib/core/convert.py
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions lib/core/datatype.py
Expand Up @@ -47,11 +47,11 @@ def __setattr__(self, item, value):
"""

# 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:
Expand Down
2 changes: 1 addition & 1 deletion plugins/dbms/maxdb/enumeration.py
Expand Up @@ -81,7 +81,7 @@ def getTables(self, bruteForce=None):

if retVal:
for table in retVal[0].values()[0]:
if not kb.data.cachedTables.has_key(db):
if db not in kb.data.cachedTables:
kb.data.cachedTables[db] = [table]
else:
kb.data.cachedTables[db].append(table)
Expand Down
2 changes: 1 addition & 1 deletion plugins/dbms/sybase/enumeration.py
Expand Up @@ -145,7 +145,7 @@ def getTables(self, bruteForce=None):

if retVal:
for table in retVal[0].values()[0]:
if not kb.data.cachedTables.has_key(db):
if db not in kb.data.cachedTables:
kb.data.cachedTables[db] = [table]
else:
kb.data.cachedTables[db].append(table)
Expand Down

0 comments on commit 1712603

Please sign in to comment.