From 3193c6df8a216ce7189f55d4a9c895c18b185c4e Mon Sep 17 00:00:00 2001
From: Li-zhigang
Date: Tue, 22 Nov 2016 16:10:28 +0800
Subject: [PATCH] Replace six.iteritems() with .items()
Change-Id: Icb3bc570aa7ab1ed2f2304739e034127aecdbeed
---
neutron_lib/api/converters.py | 2 +-
neutron_lib/api/validators.py | 6 +++---
neutron_lib/tests/_base.py | 3 +--
neutron_lib/utils/helpers.py | 2 +-
4 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/neutron_lib/api/converters.py b/neutron_lib/api/converters.py
index 9bb6f2422..600e64a43 100644
--- a/neutron_lib/api/converters.py
+++ b/neutron_lib/api/converters.py
@@ -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):
diff --git a/neutron_lib/api/validators.py b/neutron_lib/api/validators.py
index 442eebcdf..b8f5c6b55 100644
--- a/neutron_lib/api/validators.py
+++ b/neutron_lib/api/validators.py
@@ -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:
diff --git a/neutron_lib/tests/_base.py b/neutron_lib/tests/_base.py
index 56b549e53..3662269ce 100644
--- a/neutron_lib/tests/_base.py
+++ b/neutron_lib/tests/_base.py
@@ -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):
diff --git a/neutron_lib/utils/helpers.py b/neutron_lib/utils/helpers.py
index d84644bce..bbd655786 100644
--- a/neutron_lib/utils/helpers.py
+++ b/neutron_lib/utils/helpers.py
@@ -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):