Smooth over some differences with six

In the effort to port bandit to python 3, we need to start depending on
some tools to make the porting easier. This adds a dependency on six and
takes care of the two cases where we call iteritems.

Change-Id: I2e687713de7f910104ab1f7c62e7c677052993c4
This commit is contained in:
Ian Cordasco 2015-06-01 14:23:04 -05:00
parent 950bd9d2d2
commit e7bf93f742
3 changed files with 7 additions and 3 deletions

View File

@ -25,6 +25,8 @@ import json
import linecache
from operator import itemgetter
import six
from bandit.core import constants
from bandit.core import utils
@ -180,7 +182,7 @@ class BanditResultStore():
machine_output['errors'].append({'filename': fname,
'reason': reason})
for filer, score in stats.iteritems():
for filer, score in six.iteritems(stats):
totals = {}
for i in range(self.level, len(constants.RANKING)):
severity = constants.RANKING[i]

View File

@ -16,6 +16,8 @@
import copy
import six
from bandit.core import constants
from bandit.core import context as b_context
@ -50,7 +52,7 @@ class BanditTester():
if not raw_context['lineno'] in raw_context['skip_lines']:
tests = self.testset.get_tests(checktype)
for name, test in tests.iteritems():
for name, test in six.iteritems(tests):
# execute test with the an instance of the context class
temp_context = copy.copy(raw_context)
context = b_context.Context(temp_context)

View File

@ -1,2 +1,2 @@
PyYAML>=3.1.0
six>=1.9.0