Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1712603

Browse files
committed
Replacing deprecated has_key() with operator in (PEP8)
1 parent e4a3c01 commit 1712603

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

extra/sqlharvest/sqlharvest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def main():
9292
req = urllib2.Request(sqlfile)
9393
response = urllib2.urlopen(req)
9494

95-
if response.headers.has_key("Content-Length"):
95+
if "Content-Length" in response.headers:
9696
if int(response.headers.get("Content-Length")) > MAX_FILE_SIZE:
9797
continue
9898

lib/core/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def hexencode(value):
4747
return utf8encode(value).encode("hex")
4848

4949
def md5hash(value):
50-
if sys.modules.has_key('hashlib'):
50+
if "hashlib" in sys.modules:
5151
return hashlib.md5(value).hexdigest()
5252
else:
5353
return md5.new(value).hexdigest()
@@ -60,7 +60,7 @@ def ordencode(value):
6060
return tuple(ord(char) for char in value)
6161

6262
def sha1hash(value):
63-
if sys.modules.has_key('hashlib'):
63+
if "hashlib" in sys.modules:
6464
return hashlib.sha1(value).hexdigest()
6565
else:
6666
return sha.new(value).hexdigest()

lib/core/datatype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def __setattr__(self, item, value):
4747
"""
4848

4949
# This test allows attributes to be set in the __init__ method
50-
if not self.__dict__.has_key('_AttribDict__initialised'):
50+
if "_AttribDict__initialised" not in self.__dict__:
5151
return dict.__setattr__(self, item, value)
5252

5353
# Any normal attributes are handled normally
54-
elif self.__dict__.has_key(item):
54+
elif item in self.__dict__:
5555
dict.__setattr__(self, item, value)
5656

5757
else:

plugins/dbms/maxdb/enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def getTables(self, bruteForce=None):
8181

8282
if retVal:
8383
for table in retVal[0].values()[0]:
84-
if not kb.data.cachedTables.has_key(db):
84+
if db not in kb.data.cachedTables:
8585
kb.data.cachedTables[db] = [table]
8686
else:
8787
kb.data.cachedTables[db].append(table)

plugins/dbms/sybase/enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def getTables(self, bruteForce=None):
145145

146146
if retVal:
147147
for table in retVal[0].values()[0]:
148-
if not kb.data.cachedTables.has_key(db):
148+
if db not in kb.data.cachedTables:
149149
kb.data.cachedTables[db] = [table]
150150
else:
151151
kb.data.cachedTables[db].append(table)

0 commit comments

Comments
 (0)