Replace six.iteritems() with .items()

1. As mentioned in [1], we should avoid using six.iteritems to achieve
   iterators. We can use dict.items instead, as it will return iterators
   in PY3 as well. And dict.items/keys will more readable.

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

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85
Implements: blueprint replace-iteritems-with-items
This commit is contained in:
lihaijing 2017-07-07 11:48:48 +08:00 committed by Akihiro Motoki
parent 4b575083b7
commit d15bbada73
76 changed files with 148 additions and 222 deletions

View File

@ -93,8 +93,7 @@ OpenStackClient strives to be Python 3.3 compatible. Common guidelines:
* Convert print statements to functions: print statements should be converted
to an appropriate log or other output mechanism.
* Use six where applicable: x.iteritems is converted to six.iteritems(x)
for example.
* Prefer to x.items() over six.iteritems(x).
Running Tests
-------------

View File

@ -19,7 +19,6 @@ import os
import sys
from osc_lib import utils
import six
from six.moves import urllib
from openstackclient.api import api
@ -559,7 +558,7 @@ class APIv1(api.BaseAPI):
log = logging.getLogger(__name__ + '._set_properties')
headers = {}
for k, v in six.iteritems(properties):
for k, v in properties.items():
if not utils.is_ascii(k) or not utils.is_ascii(v):
log.error('Cannot set property %s to non-ascii value', k)
continue
@ -572,7 +571,7 @@ class APIv1(api.BaseAPI):
# Add in properties as a top level key, this is consistent with other
# OSC commands
properties = {}
for k, v in six.iteritems(headers):
for k, v in headers.items():
if k.lower().startswith(header_tag):
properties[k[len(header_tag):]] = v
return properties

View File

@ -19,7 +19,6 @@ import logging
from novaclient import exceptions as nova_exceptions
from osc_lib.command import command
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -47,11 +46,11 @@ def _xform_compute_availability_zone(az, include_extra):
return result
if hasattr(az, 'hosts') and az.hosts:
for host, services in six.iteritems(az.hosts):
for host, services in az.hosts.items():
host_info = copy.deepcopy(zone_info)
host_info['host_name'] = host
for svc, state in six.iteritems(services):
for svc, state in services.items():
info = copy.deepcopy(host_info)
info['service_name'] = svc
info['service_status'] = '%s %s %s' % (

View File

@ -15,7 +15,6 @@
from keystoneauth1.loading import base
from osc_lib.command import command
import six
from openstackclient.i18n import _
@ -59,9 +58,9 @@ class ShowConfiguration(command.ShowOne):
if o.secret
]
for key, value in six.iteritems(info.pop('auth', {})):
for key, value in info.pop('auth', {}).items():
if parsed_args.mask and key.lower() in secret_opts:
value = REDACTED
info['auth.' + key] = value
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -19,7 +19,6 @@ import sys
from osc_lib.command import command
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -113,4 +112,4 @@ class ListModule(command.ShowOne):
# Catch all exceptions, just skip it
pass
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))

View File

@ -21,7 +21,6 @@ import sys
from osc_lib.command import command
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.network import common
@ -663,4 +662,4 @@ class ShowQuota(command.ShowOne, BaseQuota):
project_name = project_info['name']
info['project_name'] = project_name
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -20,7 +20,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -77,7 +76,7 @@ class CreateAgent(command.ShowOne):
parsed_args.hypervisor
)
agent = compute_client.agents.create(*args)._info.copy()
return zip(*sorted(six.iteritems(agent)))
return zip(*sorted(agent.items()))
class DeleteAgent(command.Command):

View File

@ -23,7 +23,6 @@ from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -68,7 +67,7 @@ class AddAggregateHost(command.ShowOne):
'properties': format_columns.DictColumn(info.pop('metadata')),
},
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class CreateAggregate(command.ShowOne):
@ -125,7 +124,7 @@ class CreateAggregate(command.ShowOne):
'properties': properties,
},
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteAggregate(command.Command):
@ -255,7 +254,7 @@ class RemoveAggregateHost(command.ShowOne):
'properties': format_columns.DictColumn(info.pop('metadata')),
},
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class SetAggregate(command.Command):
@ -372,7 +371,7 @@ class ShowAggregate(command.ShowOne):
info = {}
info.update(data._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class UnsetAggregate(command.Command):

View File

@ -18,7 +18,6 @@
from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -138,4 +137,4 @@ class ShowConsoleURL(command.ShowOne):
# handle for different microversion API.
console_data = data.get('remote_console', data.get('console'))
info.update(console_data)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -22,7 +22,6 @@ from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
@ -195,7 +194,7 @@ class CreateFlavor(command.ShowOne):
flavor_info.pop("links")
flavor_info['properties'] = utils.format_dict(flavor.get_keys())
return zip(*sorted(six.iteritems(flavor_info)))
return zip(*sorted(flavor_info.items()))
class DeleteFlavor(command.Command):
@ -447,7 +446,7 @@ class ShowFlavor(command.ShowOne):
flavor['properties'] = utils.format_dict(resource_flavor.get_keys())
return zip(*sorted(six.iteritems(flavor)))
return zip(*sorted(flavor.items()))
class UnsetFlavor(command.Command):

View File

@ -20,7 +20,6 @@ import re
from novaclient import exceptions as nova_exceptions
from osc_lib.command import command
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -126,4 +125,4 @@ class ShowHypervisor(command.ShowOne):
hypervisor["service_host"] = hypervisor["service"]["host"]
del hypervisor["service"]
return zip(*sorted(six.iteritems(hypervisor)))
return zip(*sorted(hypervisor.items()))

View File

@ -15,7 +15,6 @@
"""Hypervisor Stats action implementations"""
from osc_lib.command import command
import six
from openstackclient.i18n import _
@ -27,4 +26,4 @@ class ShowHypervisorStats(command.ShowOne):
compute_client = self.app.client_manager.compute
hypervisor_stats = compute_client.hypervisors.statistics().to_dict()
return zip(*sorted(six.iteritems(hypervisor_stats)))
return zip(*sorted(hypervisor_stats.items()))

View File

@ -23,7 +23,6 @@ import sys
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -101,7 +100,7 @@ class CreateKeypair(command.ShowOne):
del info['public_key']
if 'private_key' in info:
del info['private_key']
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
else:
sys.stdout.write(keypair.private_key)
return ({}, {})
@ -184,7 +183,7 @@ class ShowKeypair(command.ShowOne):
info.update(keypair._info)
if not parsed_args.public_key:
del info['public_key']
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
else:
# NOTE(dtroyer): a way to get the public key in a similar form
# as the private key in the create command

View File

@ -1069,7 +1069,7 @@ class CreateServer(command.ShowOne):
raise SystemExit
details = _prep_server_detail(compute_client, image_client, server)
return zip(*sorted(six.iteritems(details)))
return zip(*sorted(details.items()))
class CreateServerDump(command.Command):
@ -1967,7 +1967,7 @@ class RebuildServer(command.ShowOne):
details = _prep_server_detail(compute_client, image_client, server,
refresh=False)
return zip(*sorted(six.iteritems(details)))
return zip(*sorted(details.items()))
class RemoveFixedIP(command.Command):
@ -2537,7 +2537,7 @@ class ShowServer(command.ShowOne):
self.app.client_manager.image, server,
refresh=False)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class SshServer(command.Command):

View File

@ -19,7 +19,6 @@ from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
from oslo_utils import importutils
import six
from openstackclient.i18n import _
@ -129,4 +128,4 @@ class CreateServerBackup(command.ShowOne):
]
)
info = image_module._format_image(image)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -19,7 +19,6 @@ import logging
from osc_lib.command import command
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -122,4 +121,4 @@ class ShowServerEvent(command.ShowOne):
action_detail = compute_client.instance_action.get(
server_id, parsed_args.request_id)
return zip(*sorted(six.iteritems(action_detail.to_dict())))
return zip(*sorted(action_detail.to_dict().items()))

View File

@ -21,7 +21,6 @@ from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
from oslo_utils import importutils
import six
from openstackclient.i18n import _
@ -109,4 +108,4 @@ class CreateServerImage(command.ShowOne):
]
)
info = image_module._format_image(image)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -21,7 +21,6 @@ import datetime
from novaclient import api_versions
from osc_lib.command import command
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -236,4 +235,4 @@ class ShowUsage(command.ShowOne):
info['Disk GB-Hours'] = (
float("%.2f" % usage.total_local_gb_usage)
if hasattr(usage, "total_local_gb_usage") else None)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -19,7 +19,6 @@ from cliff import columns as cliff_columns
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -102,4 +101,4 @@ class ShowCatalog(command.ShowOne):
LOG.error(_('service %s not found\n'), parsed_args.service)
return ((), ())
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))

View File

@ -21,7 +21,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -82,7 +81,7 @@ class CreateEC2Creds(command.ShowOne):
{'project_id': info.pop('tenant_id')}
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteEC2Creds(command.Command):
@ -206,4 +205,4 @@ class ShowEC2Creds(command.ShowOne):
{'project_id': info.pop('tenant_id')}
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -20,7 +20,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -76,7 +75,7 @@ class CreateEndpoint(command.ShowOne):
info.update(endpoint._info)
info['service_name'] = service.name
info['service_type'] = service.type
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteEndpoint(command.Command):
@ -178,4 +177,4 @@ class ShowEndpoint(command.ShowOne):
info.update(match._info)
info['service_name'] = service.name
info['service_type'] = service.type
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -23,7 +23,6 @@ from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -100,7 +99,7 @@ class CreateProject(command.ShowOne):
# TODO(stevemar): Remove the line below when we support multitenancy
project._info.pop('parent_id', None)
return zip(*sorted(six.iteritems(project._info)))
return zip(*sorted(project._info.items()))
class DeleteProject(command.Command):
@ -299,7 +298,7 @@ class ShowProject(command.ShowOne):
properties[k] = v
info['properties'] = format_columns.DictColumn(properties)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class UnsetProject(command.Command):

View File

@ -21,7 +21,6 @@ from keystoneauth1 import exceptions as ks_exc
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -69,7 +68,7 @@ class AddRole(command.ShowOne):
info = {}
info.update(role._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class CreateRole(command.ShowOne):
@ -105,7 +104,7 @@ class CreateRole(command.ShowOne):
info = {}
info.update(role._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteRole(command.Command):
@ -217,4 +216,4 @@ class ShowRole(command.ShowOne):
info = {}
info.update(role._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -20,7 +20,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -65,7 +64,7 @@ class CreateService(command.ShowOne):
info = {}
info.update(service._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteService(command.Command):
@ -153,11 +152,11 @@ class ShowService(command.ShowOne):
if parsed_args.catalog:
endpoints = auth_ref.service_catalog.get_endpoints(
service_type=parsed_args.service)
for (service, service_endpoints) in six.iteritems(endpoints):
for (service, service_endpoints) in endpoints.items():
if service_endpoints:
info = {"type": service}
info.update(service_endpoints[0])
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
msg = _("No service catalog with a type, name or ID of '%s' "
"exists.") % (parsed_args.service)
@ -166,4 +165,4 @@ class ShowService(command.ShowOne):
service = common.find_service(identity_client, parsed_args.service)
info = {}
info.update(service._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -17,7 +17,6 @@
from osc_lib.command import command
from osc_lib import exceptions
import six
from openstackclient.i18n import _
@ -49,7 +48,7 @@ class IssueToken(command.ShowOne):
data['project_id'] = auth_ref.project_id
if auth_ref.user_id:
data['user_id'] = auth_ref.user_id
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class RevokeToken(command.Command):

View File

@ -23,7 +23,6 @@ from keystoneauth1 import exceptions as ks_exc
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -154,7 +153,7 @@ class CreateUser(command.ShowOne):
info = {}
info.update(user._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteUser(command.Command):
@ -418,4 +417,4 @@ class ShowUser(command.ShowOne):
{'project_id': info.pop('tenant_id')}
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -21,7 +21,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -123,7 +122,7 @@ class CreateApplicationCredential(command.ShowOne):
msg = ' '.join(r['name'] for r in roles)
application_credential._info['roles'] = msg
return zip(*sorted(six.iteritems(application_credential._info)))
return zip(*sorted(application_credential._info.items()))
class DeleteApplicationCredential(command.Command):
@ -217,4 +216,4 @@ class ShowApplicationCredential(command.ShowOne):
msg = ' '.join(r['name'] for r in roles)
app_cred._info['roles'] = msg
return zip(*sorted(six.iteritems(app_cred._info)))
return zip(*sorted(app_cred._info.items()))

View File

@ -19,7 +19,6 @@ from cliff import columns as cliff_columns
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -97,4 +96,4 @@ class ShowCatalog(command.ShowOne):
LOG.error(_('service %s not found\n'), parsed_args.service)
return ((), ())
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))

View File

@ -20,7 +20,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -46,7 +45,7 @@ class CreateConsumer(command.ShowOne):
parsed_args.description
)
consumer._info.pop('links', None)
return zip(*sorted(six.iteritems(consumer._info)))
return zip(*sorted(consumer._info.items()))
class DeleteConsumer(command.Command):
@ -142,4 +141,4 @@ class ShowConsumer(command.ShowOne):
identity_client.oauth1.consumers, parsed_args.consumer)
consumer._info.pop('links', None)
return zip(*sorted(six.iteritems(consumer._info)))
return zip(*sorted(consumer._info.items()))

View File

@ -20,7 +20,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -74,7 +73,7 @@ class CreateCredential(command.ShowOne):
project=project)
credential._info.pop('links')
return zip(*sorted(six.iteritems(credential._info)))
return zip(*sorted(credential._info.items()))
class DeleteCredential(command.Command):
@ -225,4 +224,4 @@ class ShowCredential(command.ShowOne):
parsed_args.credential)
credential._info.pop('links')
return zip(*sorted(six.iteritems(credential._info)))
return zip(*sorted(credential._info.items()))

View File

@ -21,7 +21,6 @@ from keystoneauth1 import exceptions as ks_exc
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -85,7 +84,7 @@ class CreateDomain(command.ShowOne):
raise
domain._info.pop('links')
return zip(*sorted(six.iteritems(domain._info)))
return zip(*sorted(domain._info.items()))
class DeleteDomain(command.Command):
@ -206,4 +205,4 @@ class ShowDomain(command.ShowOne):
domain_str)
domain._info.pop('links')
return zip(*sorted(six.iteritems(domain._info)))
return zip(*sorted(domain._info.items()))

View File

@ -17,7 +17,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -108,7 +107,7 @@ class CreateEC2Creds(command.ShowOne):
{'project_id': info.pop('tenant_id')}
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteEC2Creds(command.Command):
@ -209,4 +208,4 @@ class ShowEC2Creds(command.ShowOne):
{'project_id': info.pop('tenant_id')}
)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -20,7 +20,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -131,7 +130,7 @@ class CreateEndpoint(command.ShowOne):
info.update(endpoint._info)
info['service_name'] = get_service_name(service)
info['service_type'] = service.type
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteEndpoint(command.Command):
@ -389,4 +388,4 @@ class ShowEndpoint(command.ShowOne):
info.update(endpoint._info)
info['service_name'] = get_service_name(service)
info['service_type'] = service.type
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -19,7 +19,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -129,7 +128,7 @@ class CreateEndpointGroup(command.ShowOne, _FiltersReader):
info = {}
endpoint_group._info.pop('links')
info.update(endpoint_group._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteEndpointGroup(command.Command):
@ -321,4 +320,4 @@ class ShowEndpointGroup(command.ShowOne):
info = {}
endpoint_group._info.pop('links')
info.update(endpoint_group._info)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -19,7 +19,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -68,7 +67,7 @@ class CreateProtocol(command.ShowOne):
info['identity_provider'] = parsed_args.identity_provider
info['mapping'] = info.pop('mapping_id')
info.pop('links', None)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class DeleteProtocol(command.Command):
@ -175,7 +174,7 @@ class SetProtocol(command.Command):
# user.
info['identity_provider'] = parsed_args.identity_provider
info['mapping'] = info.pop('mapping_id')
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))
class ShowProtocol(command.ShowOne):
@ -205,4 +204,4 @@ class ShowProtocol(command.ShowOne):
info = dict(protocol._info)
info['mapping'] = info.pop('mapping_id')
info.pop('links', None)
return zip(*sorted(six.iteritems(info)))
return zip(*sorted(info.items()))

View File

@ -21,7 +21,6 @@ from keystoneauth1 import exceptions as ks_exc
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -182,7 +181,7 @@ class CreateGroup(command.ShowOne):
raise
group._info.pop('links')
return zip(*sorted(six.iteritems(group._info)))
return zip(*sorted(group._info.items()))
class DeleteGroup(command.Command):
@ -405,4 +404,4 @@ class ShowGroup(command.ShowOne):
domain_name_or_id=parsed_args.domain)
group._info.pop('links')
return zip(*sorted(six.iteritems(group._info)))
return zip(*sorted(group._info.items()))

View File

@ -19,7 +19,6 @@ from osc_lib.cli import format_columns
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -106,7 +105,7 @@ class CreateIdentityProvider(command.ShowOne):
idp._info.pop('links', None)
remote_ids = format_columns.ListColumn(idp._info.pop('remote_ids', []))
idp._info['remote_ids'] = remote_ids
return zip(*sorted(six.iteritems(idp._info)))
return zip(*sorted(idp._info.items()))
class DeleteIdentityProvider(command.Command):
@ -248,4 +247,4 @@ class ShowIdentityProvider(command.ShowOne):
idp._info.pop('links', None)
remote_ids = format_columns.ListColumn(idp._info.pop('remote_ids', []))
idp._info['remote_ids'] = remote_ids
return zip(*sorted(six.iteritems(idp._info)))
return zip(*sorted(idp._info.items()))

View File

@ -18,7 +18,6 @@
import logging
from osc_lib.command import command
import six
from openstackclient.i18n import _
@ -75,7 +74,7 @@ class CreateImpliedRole(command.ShowOne):
prior_role_id, implied_role_id)
response._info.pop('links', None)
return zip(*sorted([(k, v['id'])
for k, v in six.iteritems(response._info)]))
for k, v in response._info.items()]))
class DeleteImpliedRole(command.Command):

View File

@ -18,7 +18,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common as common_utils
@ -102,7 +101,7 @@ class CreateLimit(command.ShowOne):
)
limit._info.pop('links', None)
return zip(*sorted(six.iteritems(limit._info)))
return zip(*sorted(limit._info.items()))
class ListLimit(command.Lister):
@ -198,7 +197,7 @@ class ShowLimit(command.ShowOne):
identity_client = self.app.client_manager.identity
limit = identity_client.limits.get(parsed_args.limit_id)
limit._info.pop('links', None)
return zip(*sorted(six.iteritems(limit._info)))
return zip(*sorted(limit._info.items()))
class SetLimit(command.ShowOne):
@ -236,7 +235,7 @@ class SetLimit(command.ShowOne):
limit._info.pop('links', None)
return zip(*sorted(six.iteritems(limit._info)))
return zip(*sorted(limit._info.items()))
class DeleteLimit(command.Command):

View File

@ -21,7 +21,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -107,7 +106,7 @@ class CreateMapping(command.ShowOne, _RulesReader):
rules=rules)
mapping._info.pop('links', None)
return zip(*sorted(six.iteritems(mapping._info)))
return zip(*sorted(mapping._info.items()))
class DeleteMapping(command.Command):
@ -202,4 +201,4 @@ class ShowMapping(command.ShowOne):
mapping = identity_client.federation.mappings.get(parsed_args.mapping)
mapping._info.pop('links', None)
return zip(*sorted(six.iteritems(mapping._info)))
return zip(*sorted(mapping._info.items()))

View File

@ -20,7 +20,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -57,7 +56,7 @@ class CreatePolicy(command.ShowOne):
policy._info.pop('links')
policy._info.update({'rules': policy._info.pop('blob')})
return zip(*sorted(six.iteritems(policy._info)))
return zip(*sorted(policy._info.items()))
class DeletePolicy(command.Command):
@ -176,4 +175,4 @@ class ShowPolicy(command.ShowOne):
policy._info.pop('links')
policy._info.update({'rules': policy._info.pop('blob')})
return zip(*sorted(six.iteritems(policy._info)))
return zip(*sorted(policy._info.items()))

View File

@ -22,7 +22,6 @@ from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
from openstackclient.identity import common
@ -124,7 +123,7 @@ class CreateProject(command.ShowOne):
raise
project._info.pop('links')
return zip(*sorted(six.iteritems(project._info)))
return zip(*sorted(project._info.items()))
class DeleteProject(command.Command):
@ -401,4 +400,4 @@ class ShowProject(command.ShowOne):
subtree_as_ids=parsed_args.children)
project._info.pop('links')
return zip(*sorted(six.iteritems(project._info)))
return zip(*sorted(project._info.items()))

View File

@ -18,7 +18,6 @@ import logging
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
import six
from openstackclient.i18n import _
@ -62,7 +61,7 @@ class CreateRegion(command.ShowOne):
region._info['region'] = region._info.pop('id')
region._info['parent_region'] = region._info.pop('parent_region_id')
region._info.pop('links', None)
return zip(*sorted(six.iteritems(region._info)))
return zip(*sorted(region._info.items()))
class DeleteRegion(command.Command):