Replace six.iteritems(iter) with iter.items()
As mentioned in [1], we should avoid using six.iteritems(iter) to achieve iterators. We can use iter.items() instead, as it will return iterators in PY3 as well. [1] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Change-Id: Ic41abf2ca6ec3ecb651b980091b52d0a185c9089
This commit is contained in:
parent
b8ed0c2d27
commit
8a4f61a93d
|
@ -293,7 +293,7 @@ class CrudManager(BaseManager):
|
|||
|
||||
def _filter_kwargs(self, kwargs):
|
||||
"""Drop null values and handle ids."""
|
||||
for key, ref in six.iteritems(kwargs.copy()):
|
||||
for key, ref in kwargs.copy().items():
|
||||
if ref is None:
|
||||
kwargs.pop(key)
|
||||
else:
|
||||
|
@ -489,7 +489,7 @@ class Resource(RequestIdMixin):
|
|||
return None
|
||||
|
||||
def _add_details(self, info):
|
||||
for (k, v) in six.iteritems(info):
|
||||
for (k, v) in info.items():
|
||||
try:
|
||||
try:
|
||||
setattr(self, k, v)
|
||||
|
|
|
@ -23,8 +23,6 @@ Exception definitions.
|
|||
import inspect
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class ClientException(Exception):
|
||||
"""The base exception class for all exceptions this library raises.
|
||||
|
@ -396,7 +394,7 @@ class HttpVersionNotSupported(HttpServerError):
|
|||
# _code_map contains all the classes that have http_status attribute.
|
||||
_code_map = dict(
|
||||
(getattr(obj, 'http_status', None), obj)
|
||||
for name, obj in six.iteritems(vars(sys.modules[__name__]))
|
||||
for name, obj in vars(sys.modules[__name__]).items()
|
||||
if inspect.isclass(obj) and getattr(obj, 'http_status', False)
|
||||
)
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
import logging
|
||||
import pkg_resources
|
||||
|
||||
import six
|
||||
|
||||
from cinderclient import exceptions
|
||||
from cinderclient import utils
|
||||
|
||||
|
@ -51,7 +49,7 @@ def load_auth_system_opts(parser):
|
|||
This function will try to populate the parser with options from the
|
||||
available plugins.
|
||||
"""
|
||||
for name, auth_plugin in six.iteritems(_discovered_plugins):
|
||||
for name, auth_plugin in _discovered_plugins.items():
|
||||
add_opts_fn = getattr(auth_plugin, "add_opts", None)
|
||||
if add_opts_fn:
|
||||
group = parser.add_argument_group("Auth-system '%s' options" %
|
||||
|
|
|
@ -211,7 +211,7 @@ def print_dict(d, property="Property", formatters=None):
|
|||
pt.align = 'l'
|
||||
formatters = formatters or {}
|
||||
|
||||
for r in six.iteritems(d):
|
||||
for r in d.items():
|
||||
r = list(r)
|
||||
|
||||
if r[0] in formatters:
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
"""Pools interface (v3 extension)"""
|
||||
|
||||
import six
|
||||
|
||||
from cinderclient import base
|
||||
|
||||
|
||||
|
@ -45,7 +43,7 @@ class PoolManager(base.Manager):
|
|||
# be attributes of the pool itself.
|
||||
for pool in pools:
|
||||
if hasattr(pool, 'capabilities'):
|
||||
for k, v in six.iteritems(pool.capabilities):
|
||||
for k, v in pool.capabilities.items():
|
||||
setattr(pool, k, v)
|
||||
|
||||
# Remove the capabilities dictionary since all of its
|
||||
|
|
Loading…
Reference in New Issue