Replace six.iteritems() with .items()
Change-Id: Icb3bc570aa7ab1ed2f2304739e034127aecdbeed
This commit is contained in:
parent
49698c3ea1
commit
3193c6df8a
@ -128,7 +128,7 @@ def convert_kvp_list_to_dict(kvp_list):
|
||||
key, value = convert_kvp_str_to_list(kvp_str)
|
||||
kvp_map.setdefault(key, set())
|
||||
kvp_map[key].add(value)
|
||||
return dict((x, list(y)) for x, y in six.iteritems(kvp_map))
|
||||
return dict((x, list(y)) for x, y in kvp_map.items())
|
||||
|
||||
|
||||
def convert_none_to_empty_list(value):
|
||||
|
@ -700,7 +700,7 @@ def _validate_dict_item(key, key_validator, data):
|
||||
# TODO(salv-orlando): Structure of dict attributes should be improved
|
||||
# to avoid iterating over items
|
||||
val_func = val_params = None
|
||||
for (k, v) in six.iteritems(key_validator):
|
||||
for (k, v) in key_validator.items():
|
||||
if k.startswith('type:'):
|
||||
# ask forgiveness, not permission
|
||||
try:
|
||||
@ -735,7 +735,7 @@ def validate_dict(data, key_specs=None):
|
||||
return
|
||||
|
||||
# Check whether all required keys are present
|
||||
required_keys = [key for key, spec in six.iteritems(key_specs)
|
||||
required_keys = [key for key, spec in key_specs.items()
|
||||
if spec.get('required')]
|
||||
|
||||
if required_keys:
|
||||
@ -752,7 +752,7 @@ def validate_dict(data, key_specs=None):
|
||||
|
||||
# Perform validation and conversion of all values
|
||||
# according to the specifications.
|
||||
for key, key_validator in [(k, v) for k, v in six.iteritems(key_specs)
|
||||
for key, key_validator in [(k, v) for k, v in key_specs.items()
|
||||
if k in data]:
|
||||
msg = _validate_dict_item(key, key_validator, data)
|
||||
if msg:
|
||||
|
@ -24,7 +24,6 @@ from oslo_config import cfg
|
||||
from oslo_db import options as db_options
|
||||
from oslo_utils import strutils
|
||||
import pbr.version
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from neutron_lib._i18n import _
|
||||
@ -222,7 +221,7 @@ class BaseTestCase(testtools.TestCase):
|
||||
self.assertEqual(expect_val, actual_val)
|
||||
|
||||
def sort_dict_lists(self, dic):
|
||||
for key, value in six.iteritems(dic):
|
||||
for key, value in dic.items():
|
||||
if isinstance(value, list):
|
||||
dic[key] = sorted(value)
|
||||
elif isinstance(value, dict):
|
||||
|
@ -92,7 +92,7 @@ def dict2str(dic):
|
||||
each item in dic.
|
||||
"""
|
||||
return ','.join("%s=%s" % (key, val)
|
||||
for key, val in sorted(six.iteritems(dic)))
|
||||
for key, val in sorted(dic.items()))
|
||||
|
||||
|
||||
def str2dict(string):
|
||||
|
Loading…
Reference in New Issue
Block a user