Merge "Replace six.iteritems() with .items()"
This commit is contained in:
commit
d4cf4ddc12
|
@ -84,7 +84,7 @@ class BlazarCommand(OpenStackCommand):
|
|||
return parser
|
||||
|
||||
def format_output_data(self, data):
|
||||
for k, v in six.iteritems(data):
|
||||
for k, v in data.items():
|
||||
if isinstance(v, six.text_type):
|
||||
try:
|
||||
# Deserialize if possible into dict, lists, tuples...
|
||||
|
@ -134,7 +134,7 @@ class CreateCommand(BlazarCommand, show.ShowOne):
|
|||
print('Created a new %s:' % self.resource, file=self.app.stdout)
|
||||
else:
|
||||
data = {'': ''}
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return zip(*sorted(data.items()))
|
||||
|
||||
|
||||
class UpdateCommand(BlazarCommand):
|
||||
|
@ -291,4 +291,4 @@ class ShowCommand(BlazarCommand, show.ShowOne):
|
|||
resource_manager = getattr(blazar_client, self.resource)
|
||||
data = resource_manager.get(res_id)
|
||||
self.format_output_data(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return zip(*sorted(data.items()))
|
||||
|
|
|
@ -17,7 +17,6 @@ import datetime
|
|||
import json
|
||||
import os
|
||||
import re
|
||||
import six
|
||||
|
||||
from blazarclient import exception
|
||||
from blazarclient.i18n import _
|
||||
|
@ -52,13 +51,13 @@ def to_primitive(value):
|
|||
return o
|
||||
elif isinstance(value, dict):
|
||||
o = {}
|
||||
for k, v in six.iteritems(value):
|
||||
for k, v in value.items():
|
||||
o[k] = to_primitive(v)
|
||||
return o
|
||||
elif isinstance(value, datetime.datetime):
|
||||
return str(value)
|
||||
elif hasattr(value, 'iteritems'):
|
||||
return to_primitive(dict(six.iteritems(value)))
|
||||
return to_primitive(dict(value.items()))
|
||||
elif hasattr(value, '__iter__'):
|
||||
return to_primitive(list(value))
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue