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: I8b1e3dd75c700c3c2d41223309cd6c3af1ebdddc
This commit is contained in:
parent
bb8846a3ab
commit
036d245a5e
|
@ -2156,7 +2156,7 @@ class _CachedArgumentParser(argparse.ArgumentParser):
|
|||
# not touch positional. For the reason optional opts go first in
|
||||
# the values we only need to find an index of the first positional
|
||||
# option and then sort the values slice.
|
||||
for container, values in six.iteritems(self._args_cache):
|
||||
for container, values in self._args_cache.items():
|
||||
index = 0
|
||||
has_positional = False
|
||||
for index, argument in enumerate(values):
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
# under the License.
|
||||
|
||||
import fixtures
|
||||
import six
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
@ -70,7 +69,7 @@ class Config(fixtures.Fixture):
|
|||
|
||||
group = kw.pop('group', None)
|
||||
enforce_type = kw.pop('enforce_type', False)
|
||||
for k, v in six.iteritems(kw):
|
||||
for k, v in kw.items():
|
||||
self.conf.set_override(k, v, group, enforce_type=enforce_type)
|
||||
|
||||
def _unregister_config_opts(self):
|
||||
|
@ -174,7 +173,7 @@ class Config(fixtures.Fixture):
|
|||
|
||||
raw_config = dict()
|
||||
raw_config[group] = dict()
|
||||
for key, value in six.iteritems(kwargs):
|
||||
for key, value in kwargs.items():
|
||||
# Parsed values are an array of raw strings.
|
||||
raw_config[group][key] = [str(value)]
|
||||
|
||||
|
|
Loading…
Reference in New Issue