Replace dict.itervalues/dict.iteritems and use len over filter function
partial blueprint heat-python34-support Change-Id: I2b23f068e485fd778e1d7b14d16cadb6d401163f
This commit is contained in:
parent
15f813b01f
commit
11f835b8ef
|
@ -12,6 +12,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.engine import constraints
|
||||
|
@ -48,7 +50,7 @@ class ExtraRoute(neutron.NeutronResource):
|
|||
|
||||
def add_dependencies(self, deps):
|
||||
super(ExtraRoute, self).add_dependencies(deps)
|
||||
for resource in self.stack.itervalues():
|
||||
for resource in six.itervalues(self.stack):
|
||||
# depend on any RouterInterface in this template with the same
|
||||
# router_id as this router_id
|
||||
if (resource.has_interface('OS::Neutron::RouterInterface') and
|
||||
|
|
|
@ -20,6 +20,7 @@ Resource object
|
|||
|
||||
from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import fields
|
||||
import six
|
||||
|
||||
from heat.db import api as db_api
|
||||
from heat.objects import fields as heat_fields
|
||||
|
@ -91,7 +92,7 @@ class Resource(
|
|||
resource_name,
|
||||
cls._from_db_object(cls(context), context, resource_db)
|
||||
)
|
||||
for resource_name, resource_db in resources_db.iteritems()
|
||||
for resource_name, resource_db in six.iteritems(resources_db)
|
||||
]
|
||||
return dict(resources)
|
||||
|
||||
|
@ -119,7 +120,7 @@ class Resource(
|
|||
resource_name,
|
||||
cls._from_db_object(cls(context), context, resource_db)
|
||||
)
|
||||
for resource_name, resource_db in resources_db.iteritems()
|
||||
for resource_name, resource_db in six.iteritems(resources_db)
|
||||
]
|
||||
return dict(resources)
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ class JSONResponseSerializerTest(common.HeatTestCase):
|
|||
response = webob.Response()
|
||||
serializers.JSONResponseSerializer().default(response, fixture)
|
||||
self.assertEqual(200, response.status_int)
|
||||
content_types = filter(lambda h: h[0] == 'Content-Type',
|
||||
response.headerlist)
|
||||
content_types = list(filter(lambda h: h[0] == 'Content-Type',
|
||||
response.headerlist))
|
||||
self.assertEqual(1, len(content_types))
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
self.assertEqual('{"key": "value"}', response.body)
|
||||
|
@ -103,8 +103,8 @@ class XMLResponseSerializerTest(common.HeatTestCase):
|
|||
response = webob.Response()
|
||||
serializers.XMLResponseSerializer().default(response, fixture)
|
||||
self.assertEqual(200, response.status_int)
|
||||
content_types = filter(lambda h: h[0] == 'Content-Type',
|
||||
response.headerlist)
|
||||
content_types = list(filter(lambda h: h[0] == 'Content-Type',
|
||||
response.headerlist))
|
||||
self.assertEqual(1, len(content_types))
|
||||
self.assertEqual('application/xml', response.content_type)
|
||||
self.assertEqual('<key>value</key>', response.body)
|
||||
|
|
Loading…
Reference in New Issue