Merge "Replace six.iteritems() with .items()"
This commit is contained in:
commit
38f50e0f0e
@ -166,7 +166,7 @@ class ExtensionDescriptor(object):
|
||||
if not extension_attrs_map:
|
||||
return
|
||||
|
||||
for resource, attrs in six.iteritems(extension_attrs_map):
|
||||
for resource, attrs in extension_attrs_map.items():
|
||||
extended_attrs = extended_attributes.get(resource)
|
||||
if extended_attrs:
|
||||
attrs.update(extended_attrs)
|
||||
@ -196,7 +196,7 @@ class ActionExtensionController(wsgi.Controller):
|
||||
def action(self, request, id):
|
||||
input_dict = self._deserialize(request.body,
|
||||
request.get_content_type())
|
||||
for action_name, handler in six.iteritems(self.action_handlers):
|
||||
for action_name, handler in (self.action_handlers).items():
|
||||
if action_name in input_dict:
|
||||
return handler(input_dict, request, id)
|
||||
# no action handler found (bump to downstream application)
|
||||
@ -238,7 +238,7 @@ class ExtensionController(wsgi.Controller):
|
||||
|
||||
def index(self, request):
|
||||
extensions = []
|
||||
for _alias, ext in six.iteritems(self.extension_manager.extensions):
|
||||
for _alias, ext in (self.extension_manager.extensions).items():
|
||||
extensions.append(self._translate(ext))
|
||||
return dict(extensions=extensions)
|
||||
|
||||
@ -279,7 +279,7 @@ class ExtensionMiddleware(wsgi.Middleware):
|
||||
|
||||
LOG.debug(_('Extended resource: %s'),
|
||||
resource.collection)
|
||||
for action, method in six.iteritems(resource.collection_actions):
|
||||
for action, method in (resource.collection_actions).items():
|
||||
conditions = dict(method=[method])
|
||||
path = "/%s/%s" % (resource.collection, action)
|
||||
with mapper.submapper(controller=resource.controller,
|
||||
@ -479,8 +479,7 @@ class ExtensionManager(object):
|
||||
continue
|
||||
try:
|
||||
extended_attrs = ext.get_extended_resources(version)
|
||||
for resource, resource_attrs in six.iteritems(
|
||||
extended_attrs):
|
||||
for resource, resource_attrs in extended_attrs.items():
|
||||
if attr_map.get(resource):
|
||||
attr_map[resource].update(resource_attrs)
|
||||
else:
|
||||
|
@ -102,7 +102,7 @@ def _should_validate_sub_attributes(attribute, sub_attr):
|
||||
validate = attribute.get('validate')
|
||||
return (validate and isinstance(sub_attr, collections.Iterable) and
|
||||
any([k.startswith('type:dict') and
|
||||
v for (k, v) in six.iteritems(validate)]))
|
||||
v for (k, v) in validate.items()]))
|
||||
|
||||
|
||||
def _build_subattr_match_rule(attr_name, attr, action, target):
|
||||
|
@ -541,7 +541,7 @@ class JSONV2TestCase(APIv2TestBase, testlib_api.WebTestCase):
|
||||
output_dict = res['networks'][0]
|
||||
input_dict['shared'] = False
|
||||
self.assertEqual(len(input_dict), len(output_dict))
|
||||
for k, v in six.iteritems(input_dict):
|
||||
for k, v in input_dict.items():
|
||||
self.assertEqual(v, output_dict[k])
|
||||
else:
|
||||
# expect no results
|
||||
@ -1125,8 +1125,7 @@ class SubresourceTest(base.BaseTestCase):
|
||||
|
||||
# Save the global RESOURCE_ATTRIBUTE_MAP
|
||||
self.saved_attr_map = {}
|
||||
for resource, attrs in six.iteritems(
|
||||
attributes.RESOURCE_ATTRIBUTE_MAP):
|
||||
for resource, attrs in (attributes.RESOURCE_ATTRIBUTE_MAP).items():
|
||||
self.saved_attr_map[resource] = attrs.copy()
|
||||
|
||||
self.config_parse()
|
||||
@ -1294,8 +1293,7 @@ class ExtensionTestCase(base.BaseTestCase):
|
||||
|
||||
# Save the global RESOURCE_ATTRIBUTE_MAP
|
||||
self.saved_attr_map = {}
|
||||
for resource, attrs in six.iteritems(
|
||||
attributes.RESOURCE_ATTRIBUTE_MAP):
|
||||
for resource, attrs in (attributes.RESOURCE_ATTRIBUTE_MAP).items():
|
||||
self.saved_attr_map[resource] = attrs.copy()
|
||||
|
||||
# Create the default configurations
|
||||
|
@ -654,7 +654,7 @@ class Debug(Middleware):
|
||||
resp = req.get_response(self.application)
|
||||
|
||||
print(("*" * 40) + " RESPONSE HEADERS")
|
||||
for (key, value) in six.iteritems(resp.headers):
|
||||
for (key, value) in (resp.headers).items():
|
||||
print(key, "=", value)
|
||||
print()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user