Use dict.items() dirrectly instead of six.iteritems

Replacing dict.iteritems()/.itervalues() with
six.iteritems(dict)/six.itervalues(dict) was preferred in the past,
but there was a discussion suggesting to avoid six for this.

ref:
http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: I63b1e51597307862968f37803ffdbba63306d8c6
This commit is contained in:
ting.wang
2016-01-14 14:02:36 +08:00
parent dc6b8aad7e
commit 08fc69cfc4
6 changed files with 8 additions and 12 deletions

View File

@@ -18,7 +18,6 @@ Utils for testing the API service.
import datetime
import json
import six
from watcher.api.controllers.v1 import action as action_ctrl
from watcher.api.controllers.v1 import action_plan as action_plan_ctrl
from watcher.api.controllers.v1 import audit as audit_ctrl
@@ -78,7 +77,7 @@ def remove_internal(values, internal):
# NOTE(yuriyz): internal attributes should not be posted, except uuid
int_attr = [attr.lstrip('/') for attr in internal if attr != '/uuid']
return dict(
(k, v) for (k, v) in six.iteritems(values) if k not in int_attr
(k, v) for (k, v) in values.items() if k not in int_attr
)