Don't use .keys() method while iterating over dict

Closes-bug: #1600132

Change-Id: I49ee06d795280f572db07c9537310433f07bd0ab
This commit is contained in:
Artem Panchenko 2016-07-08 10:23:16 +03:00
parent 8bc87831bd
commit fa2d058d49
4 changed files with 7 additions and 6 deletions

View File

@ -508,7 +508,7 @@ def check_stats_on_collector(collector_remote, postgres_actions, master_uuid):
# Check that important data (clusters number, nodes number, nodes roles,
# user's email, used operation system, OpenStack stats) is saved correctly
for stat_type in general_stats.keys():
for stat_type in general_stats:
assert_true(
isinstance(summ_stats[stat_type], general_stats[stat_type]),
"Installation structure in Collector's DB doesn't contain"
@ -568,7 +568,7 @@ def check_stats_private_info(collector_remote, postgres_actions,
_has_private_data = False
# Check that stats doesn't contain private data (e.g.
# specific passwords, settings, emails)
for _private in private_data.keys():
for _private in private_data:
_regex = r'(?P<key>"\S+"): (?P<value>[^:]*"{0}"[^:]*)'.format(
private_data[_private])
for _match in re.finditer(_regex, data):
@ -584,7 +584,7 @@ def check_stats_private_info(collector_remote, postgres_actions,
_has_private_data = True
# Check that stats doesn't contain private types of data (e.g. any kind
# of passwords)
for _data_type in secret_data_types.keys():
for _data_type in secret_data_types:
_regex = (r'(?P<secret>"[^"]*{0}[^"]*": (\{{[^\}}]+\}}|\[[^\]+]\]|'
r'"[^"]+"))').format(secret_data_types[_data_type])

View File

@ -396,7 +396,7 @@ def get_slaves_ids_by_role(slaves, role=None):
def verify_fix_apply_step(apply_step):
validation_schema = patching_validation_schema
for key in validation_schema.keys():
for key in validation_schema:
if key in apply_step.keys():
is_exists = apply_step[key] is not None
else:

View File

@ -440,7 +440,8 @@ def get_global_failure_group_list(
failure_group_dict[key] = []
failure_group_dict[key].append(failure)
# let's find Levenshtein distance and update failure_group_dict
for num1, key1 in enumerate(failure_group_dict.keys()):
for num1, key1 in enumerate(failure_group_dict):
# pylint: disable=C0201
for key2 in failure_group_dict.keys()[num1 + 1:]:
# let's skip grouping if len are different more 10%
if key1 == key2 or abs(float(len(key1) / len(key2))) >\

View File

@ -73,7 +73,7 @@ class TestResult(object):
@property
def status(self):
for s in self.available_statuses.keys():
for s in self.available_statuses:
if self._status in self.available_statuses[s]:
return s
logger.error('Unsupported result status: "{0}"!'.format(self._status))