diff options
author | M V P Nitesh <m.nitesh@nectechnologies.in> | 2017-03-31 15:15:17 +0530 |
---|---|---|
committer | M V P Nitesh <m.nitesh@nectechnologies.in> | 2017-03-31 15:16:54 +0530 |
commit | 61aa092ce5cdee495e6faf63c36419e5583d3627 (patch) | |
tree | db02760894ea1da0f1489197470acad35d919b7c /heatclient/common | |
parent | 954e475a6a0a12432ec325d7579460fabcf3f40a (diff) | |
download | python-heatclient-61aa092ce5cdee495e6faf63c36419e5583d3627.tar.gz |
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
Change-Id: I3913e8876b34e112140788d7a405da6eedfb5f29
Diffstat (limited to 'heatclient/common')
-rw-r--r-- | heatclient/common/base.py | 4 | ||||
-rw-r--r-- | heatclient/common/template_utils.py | 4 | ||||
-rw-r--r-- | heatclient/common/utils.py | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/heatclient/common/base.py b/heatclient/common/base.py index f631603..cca6a43 100644 --- a/heatclient/common/base.py +++ b/heatclient/common/base.py @@ -293,7 +293,7 @@ class CrudManager(BaseManager): def _filter_kwargs(self, kwargs): """Drop null values and handle ids.""" - for key, ref in six.iteritems(kwargs.copy()): + for key, ref in kwargs.copy().items(): if ref is None: kwargs.pop(key) else: @@ -451,7 +451,7 @@ class Resource(object): return None def _add_details(self, info): - for (k, v) in six.iteritems(info): + for (k, v) in info.items(): try: setattr(self, k, v) self._info[k] = v diff --git a/heatclient/common/template_utils.py b/heatclient/common/template_utils.py index c81da43..9e9c85b 100644 --- a/heatclient/common/template_utils.py +++ b/heatclient/common/template_utils.py @@ -144,7 +144,7 @@ def get_file_contents(from_data, files, base_url=None, is_object, object_request) if isinstance(from_data, dict): - for key, value in six.iteritems(from_data): + for key, value in from_data.items(): if ignore_if and ignore_if(key, value): continue @@ -351,7 +351,7 @@ def resolve_environment_urls(resource_registry, files, env_base_url, get_file_contents(rr, files, base_url, ignore_if, is_object=is_object, object_request=object_request) - for res_name, res_dict in six.iteritems(rr.get('resources', {})): + for res_name, res_dict in rr.get('resources', {}).items(): res_base_url = res_dict.get('base_url', base_url) get_file_contents( res_dict, files, res_base_url, ignore_if, diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py index 013e692..c9d1ec0 100644 --- a/heatclient/common/utils.py +++ b/heatclient/common/utils.py @@ -376,7 +376,7 @@ def format_parameter_file(param_files, template_file=None, template_file, template_url)) param_file = {} - for key, value in six.iteritems(params): + for key, value in params.items(): param_file[key] = resolve_param_get_file(value, template_base_url) return param_file |