Replace six iteration methods with standard ones
1.As mentioned in [1], we should avoid using six.iterXXX to achieve iterators. We can use dict.XXX instead, as it will return iterators in PY3 as well. 2.In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Change-Id: I801290be0a2afa929a657821c419f935a908c5b4
This commit is contained in:
parent
0e15d37fcf
commit
57f28e44b9
@ -17,7 +17,6 @@ import collections
|
||||
import time
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from swiftclient import utils as swift_utils
|
||||
|
||||
@ -260,7 +259,7 @@ class GlanceImageService(base_image_service.BaseImageService,
|
||||
int(time.time()) +
|
||||
CONF.glance.swift_temp_url_expected_download_start_delay)
|
||||
keys_to_remove = [
|
||||
k for k, v in six.iteritems(self._cache)
|
||||
k for k, v in self._cache.items()
|
||||
if (v.url_expires_at < max_valid_time)]
|
||||
for k in keys_to_remove:
|
||||
del self._cache[k]
|
||||
|
@ -13,7 +13,6 @@
|
||||
import functools
|
||||
|
||||
from oslo_serialization import jsonutils as json
|
||||
import six
|
||||
from six.moves.urllib import parse as urllib
|
||||
from tempest.lib.common import api_version_utils
|
||||
from tempest.lib.common import rest_client
|
||||
@ -98,7 +97,7 @@ class BaremetalClient(rest_client.RestClient):
|
||||
|
||||
"""
|
||||
def get_change(kwargs, path='/'):
|
||||
for name, value in six.iteritems(kwargs):
|
||||
for name, value in kwargs.items():
|
||||
if isinstance(value, dict):
|
||||
for ch in get_change(value, path + '%s/' % name):
|
||||
yield ch
|
||||
|
@ -11,7 +11,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from tempest import test
|
||||
@ -29,7 +28,7 @@ class TestChassis(base.BaseBaremetalTest):
|
||||
|
||||
def _assertExpected(self, expected, actual):
|
||||
# Check if not expected keys/values exists in actual response body
|
||||
for key, value in six.iteritems(expected):
|
||||
for key, value in expected.items():
|
||||
if key not in ('created_at', 'updated_at'):
|
||||
self.assertIn(key, actual)
|
||||
self.assertEqual(value, actual[key])
|
||||
|
@ -30,7 +30,7 @@ class TestNodes(base.BaseBaremetalTest):
|
||||
|
||||
def _assertExpected(self, expected, actual):
|
||||
# Check if not expected keys/values exists in actual response body
|
||||
for key, value in six.iteritems(expected):
|
||||
for key, value in expected.items():
|
||||
if key not in ('created_at', 'updated_at'):
|
||||
self.assertIn(key, actual)
|
||||
self.assertEqual(value, actual[key])
|
||||
|
@ -10,7 +10,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from tempest import test
|
||||
@ -31,7 +30,7 @@ class TestPorts(base.BaseBaremetalTest):
|
||||
|
||||
def _assertExpected(self, expected, actual):
|
||||
# Check if not expected keys/values exists in actual response body
|
||||
for key, value in six.iteritems(expected):
|
||||
for key, value in expected.items():
|
||||
if key not in ('created_at', 'updated_at'):
|
||||
self.assertIn(key, actual)
|
||||
self.assertEqual(value, actual[key])
|
||||
|
Loading…
Reference in New Issue
Block a user