removed ‘has_key’ function and used ‘in’ instead to make the code python2 and python3 compatible

This commit is contained in:
Matthias Schmieder 2017-05-27 08:56:31 +02:00 committed by Matthias Krüger
parent 624ceb5027
commit cc8e80e03f
1 changed files with 3 additions and 3 deletions

View File

@ -340,7 +340,7 @@ class CppCheckHandler(XmlContentHandler):
self.versionCppcheck = attributes['version']
if name == 'error':
# is there a better solution than this?
if (attributes.has_key('inconclusive') and attributes.has_key('cwe')):
if ('inconclusive' in attributes and 'cwe' in attributes):
self.errors.append({
'file': '',
'line': 0,
@ -351,7 +351,7 @@ class CppCheckHandler(XmlContentHandler):
'inconclusive': attributes['inconclusive'],
'cwe': attributes['cwe']
})
elif attributes.has_key('inconclusive'):
elif 'inconclusive' in attributes:
self.errors.append({
'file': '',
'line': 0,
@ -361,7 +361,7 @@ class CppCheckHandler(XmlContentHandler):
'verbose': attributes.get('verbose'),
'inconclusive': attributes['inconclusive']
})
elif attributes.has_key('cwe'):
elif 'cwe' in attributes:
self.errors.append({
'file': '',
'line': 0,