Browse Source

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
changes/07/481407/4
lihaijing 4 years ago
committed by Akihiro Motoki
parent
commit
d15bbada73
  1. 3
      HACKING.rst
  2. 5
      openstackclient/api/object_store_v1.py
  3. 5
      openstackclient/common/availability_zone.py
  4. 5
      openstackclient/common/configuration.py
  5. 3
      openstackclient/common/module.py
  6. 3
      openstackclient/common/quota.py
  7. 3
      openstackclient/compute/v2/agent.py
  8. 9
      openstackclient/compute/v2/aggregate.py
  9. 3
      openstackclient/compute/v2/console.py
  10. 5
      openstackclient/compute/v2/flavor.py
  11. 3
      openstackclient/compute/v2/hypervisor.py
  12. 3
      openstackclient/compute/v2/hypervisor_stats.py
  13. 5
      openstackclient/compute/v2/keypair.py
  14. 6
      openstackclient/compute/v2/server.py
  15. 3
      openstackclient/compute/v2/server_backup.py
  16. 3
      openstackclient/compute/v2/server_event.py
  17. 3
      openstackclient/compute/v2/server_image.py
  18. 3
      openstackclient/compute/v2/usage.py
  19. 3
      openstackclient/identity/v2_0/catalog.py
  20. 5
      openstackclient/identity/v2_0/ec2creds.py
  21. 5
      openstackclient/identity/v2_0/endpoint.py
  22. 5
      openstackclient/identity/v2_0/project.py
  23. 7
      openstackclient/identity/v2_0/role.py
  24. 9
      openstackclient/identity/v2_0/service.py
  25. 3
      openstackclient/identity/v2_0/token.py
  26. 5
      openstackclient/identity/v2_0/user.py
  27. 5
      openstackclient/identity/v3/application_credential.py
  28. 3
      openstackclient/identity/v3/catalog.py
  29. 5
      openstackclient/identity/v3/consumer.py
  30. 5
      openstackclient/identity/v3/credential.py
  31. 5
      openstackclient/identity/v3/domain.py
  32. 5
      openstackclient/identity/v3/ec2creds.py
  33. 5
      openstackclient/identity/v3/endpoint.py
  34. 5
      openstackclient/identity/v3/endpoint_group.py
  35. 7
      openstackclient/identity/v3/federation_protocol.py
  36. 5
      openstackclient/identity/v3/group.py
  37. 5
      openstackclient/identity/v3/identity_provider.py
  38. 3
      openstackclient/identity/v3/implied_role.py
  39. 7
      openstackclient/identity/v3/limit.py
  40. 5
      openstackclient/identity/v3/mapping.py
  41. 5
      openstackclient/identity/v3/policy.py
  42. 5
      openstackclient/identity/v3/project.py
  43. 5
      openstackclient/identity/v3/region.py
  44. 7
      openstackclient/identity/v3/registered_limit.py
  45. 5
      openstackclient/identity/v3/role.py
  46. 5
      openstackclient/identity/v3/service.py
  47. 5
      openstackclient/identity/v3/service_provider.py
  48. 9
      openstackclient/identity/v3/token.py
  49. 5
      openstackclient/identity/v3/trust.py
  50. 5
      openstackclient/identity/v3/user.py
  51. 5
      openstackclient/image/v1/image.py
  52. 10
      openstackclient/image/v2/image.py
  53. 4
      openstackclient/network/sdk_utils.py
  54. 4
      openstackclient/network/v2/network_segment_range.py
  55. 3
      openstackclient/network/v2/security_group.py
  56. 3
      openstackclient/network/v2/security_group_rule.py
  57. 3
      openstackclient/object/v1/account.py
  58. 3
      openstackclient/object/v1/container.py
  59. 3
      openstackclient/object/v1/object.py
  60. 6
      openstackclient/tests/unit/common/test_availability_zone.py
  61. 4
      openstackclient/tests/unit/fakes.py
  62. 5
      openstackclient/volume/v1/qos_specs.py
  63. 5
      openstackclient/volume/v1/volume.py
  64. 5
      openstackclient/volume/v1/volume_backup.py
  65. 5
      openstackclient/volume/v1/volume_snapshot.py
  66. 7
      openstackclient/volume/v1/volume_transfer_request.py
  67. 5
      openstackclient/volume/v1/volume_type.py
  68. 5
      openstackclient/volume/v2/backup_record.py
  69. 5
      openstackclient/volume/v2/consistency_group.py
  70. 5
      openstackclient/volume/v2/consistency_group_snapshot.py
  71. 5
      openstackclient/volume/v2/qos_specs.py
  72. 5
      openstackclient/volume/v2/volume.py
  73. 7
      openstackclient/volume/v2/volume_backup.py
  74. 5
      openstackclient/volume/v2/volume_snapshot.py
  75. 7
      openstackclient/volume/v2/volume_transfer_request.py
  76. 5
      openstackclient/volume/v2/volume_type.py

3
HACKING.rst

@ -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
-------------

5
openstackclient/api/object_store_v1.py

@ -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

5
openstackclient/common/availability_zone.py

@ -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' % (

5
openstackclient/common/configuration.py

@ -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()))

3
openstackclient/common/module.py

@ -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()))

3
openstackclient/common/quota.py

@ -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()))

3
openstackclient/compute/v2/agent.py

@ -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):

9
openstackclient/compute/v2/aggregate.py

@ -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):

3
openstackclient/compute/v2/console.py

@ -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()))

5
openstackclient/compute/v2/flavor.py

@ -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):

3
openstackclient/compute/v2/hypervisor.py

@ -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()))

3
openstackclient/compute/v2/hypervisor_stats.py

@ -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()))

5
openstackclient/compute/v2/keypair.py

@ -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

6
openstackclient/compute/v2/server.py

@ -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):

3
openstackclient/compute/v2/server_backup.py

@ -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()))

3
openstackclient/compute/v2/server_event.py

@ -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()))

3
openstackclient/compute/v2/server_image.py

@ -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()))

3
openstackclient/compute/v2/usage.py

@ -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()))

3
openstackclient/identity/v2_0/catalog.py

@ -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()))

5
openstackclient/identity/v2_0/ec2creds.py

@ -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()))

5
openstackclient/identity/v2_0/endpoint.py

@ -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()))

5
openstackclient/identity/v2_0/project.py

@ -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):

7
openstackclient/identity/v2_0/role.py

@ -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()))

9
openstackclient/identity/v2_0/service.py

@ -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()))

3
openstackclient/identity/v2_0/token.py

@ -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):

5
openstackclient/identity/v2_0/user.py

@ -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()))

5
openstackclient/identity/v3/application_credential.py

@ -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()))

3
openstackclient/identity/v3/catalog.py

@ -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()))

5
openstackclient/identity/v3/consumer.py

@ -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()))

5
openstackclient/identity/v3/credential.py

@ -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()))

5
openstackclient/identity/v3/domain.py

@ -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()))

5
openstackclient/identity/v3/ec2creds.py

@ -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()))

5
openstackclient/identity/v3/endpoint.py

@ -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()))

5
openstackclient/identity/v3/endpoint_group.py

@ -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()))

7
openstackclient/identity/v3/federation_protocol.py

@ -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()))

5
openstackclient/identity/v3/group.py

@ -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()))

5
openstackclient/identity/v3/identity_provider.py

@ -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()))

3
openstackclient/identity/v3/implied_role.py

@ -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):

7
openstackclient/identity/v3/limit.py

@ -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):

5
openstackclient/identity/v3/mapping.py

@ -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()))

5
openstackclient/identity/v3/policy.py

@ -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()))

5
openstackclient/identity/v3/project.py

@ -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()))

5
openstackclient/identity/v3/region.py

@ -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):
@ -181,4 +180,4 @@ class ShowRegion(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()))

7
openstackclient/identity/v3/registered_limit.py

@ -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
@ -92,7 +91,7 @@ class CreateRegisteredLimit(command.ShowOne):
)
registered_limit._info.pop('links', None)
return zip(*sorted(six.iteritems(registered_limit._info)))
return zip(*sorted(registered_limit._info.items()))
class DeleteRegisteredLimit(command.Command):
@ -275,7 +274,7 @@ class SetRegisteredLimit(command.ShowOne):
)
registered_limit._info.pop('links', None)
return zip(*sorted(six.iteritems(registered_limit._info)))
return zip(*sorted(registered_limit._info.items()))
class ShowRegisteredLimit(command.ShowOne):
@ -296,4 +295,4 @@ class ShowRegisteredLimit(command.ShowOne):
parsed_args.registered_limit_id
)
registered_limit._info.pop('links', None)
return zip(*sorted(six.iteritems(registered_limit._info)))
return zip(*sorted(registered_limit._info.items()))

5
openstackclient/identity/v3/role.py

@ -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
@ -211,7 +210,7 @@ class CreateRole(command.ShowOne):
raise
role._info.pop('links')
return zip(*sorted(six.iteritems(role._info)))
return zip(*sorted(role._info.items()))
class DeleteRole(command.Command):
@ -403,4 +402,4 @@ class ShowRole(command.ShowOne):
domain_id=domain_id)
role._info.pop('links')
return zip(*sorted(six.iteritems(role._info)))
return zip(*sorted(role._info.items()))

5
openstackclient/identity/v3/service.py

@ -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
@ -77,7 +76,7 @@ class CreateService(command.ShowOne):
)
service._info.pop('links')
return zip(*sorted(six.iteritems(service._info)))
return zip(*sorted(service._info.items()))
class DeleteService(command.Command):
@ -218,4 +217,4 @@ class ShowService(command.ShowOne):
service = common.find_service(identity_client, parsed_args.service)
service._info.pop('links')
return zip(*sorted(six.iteritems(service._info)))
return zip(*sorted(service._info.items()))

5
openstackclient/identity/v3/service_provider.py

@ -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 _
@ -83,7 +82,7 @@ class CreateServiceProvider(command.ShowOne):
sp_url=parsed_args.service_provider_url)
sp._info.pop('links', None)
return zip(*sorted(six.iteritems(sp._info)))
return zip(*sorted(sp._info.items()))
class DeleteServiceProvider(command.Command):
@ -211,4 +210,4 @@ class ShowServiceProvider(command.ShowOne):
id=parsed_args.service_provider)
service_provider._info.pop('links', None)
return zip(*sorted(six.iteritems(service_provider._info)))
return zip(*sorted(service_provider._info.items()))

9
openstackclient/identity/v3/token.py

@ -18,7 +18,6 @@
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