diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-01-26 11:26:22 -0800 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-02-08 06:50:42 +0000 |
commit | 6a24addcba949be6666e59a720c6860c6377d705 (patch) | |
tree | dc430470c2e2830165e0492ce968e9ccbfc0510f | |
parent | a4241e6e9b121447a50fdfe0d79b322c2e2aaea9 (diff) |
vnfdgen: replace six.iteritems() with .items()
Openstack python3 style guide prefers to not use six.iteritems() but
instead use data.items() for all cases.
We should follow the Openstack guides since OPNFV is aligned with
Openstack
https://wiki.openstack.org/wiki/Python3#Port_Python_2_code_to_Python_3
Common patterns:
* Replace "for key in dict.iterkeys()" with "for key in dict"
* Replace dict.iteritems() with dict.items()
* Replace dict.itervalues() with dict.values()
Change-Id: I99b0505199a568771341658caf8b71c1896db9cd
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r-- | yardstick/network_services/vnf_generic/vnfdgen.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/yardstick/network_services/vnf_generic/vnfdgen.py b/yardstick/network_services/vnf_generic/vnfdgen.py index 9a02050a2..64554cdaf 100644 --- a/yardstick/network_services/vnf_generic/vnfdgen.py +++ b/yardstick/network_services/vnf_generic/vnfdgen.py @@ -16,7 +16,6 @@ from __future__ import absolute_import import collections import yaml -import six from yardstick.common.task_template import TaskTemplate @@ -46,13 +45,14 @@ def dict_key_flatten(data): """ next_data = {} + # check for non-string iterables if not any((isinstance(v, collections.Iterable) and not isinstance(v, str)) for v in data.values()): return data - for key, val in six.iteritems(data): + for key, val in data.items(): if isinstance(val, collections.Mapping): - for n_k, n_v in six.iteritems(val): + for n_k, n_v in val.items(): next_data["%s.%s" % (key, n_k)] = n_v elif isinstance(val, collections.Iterable) and not isinstance(val, str): |