diff options
author | Luong Anh Tuan <tuanla@vn.fujitsu.com> | 2016-11-22 11:25:03 +0700 |
---|---|---|
committer | Tuan Luong-Anh <tuanla@vn.fujitsu.com> | 2016-11-23 12:02:38 +0000 |
commit | d99353c44d540963688976e26bf16f1d12b77a6d (patch) | |
tree | 0f10e59f013aad6a2be1d71548ca9390eb61ce2f | |
parent | b22d9628d01920e69ae263388d5fe1f07a65641b (diff) | |
download | oslo-i18n-d99353c44d540963688976e26bf16f1d12b77a6d.tar.gz |
Replace six.iteritems() with .items()
We should avoid using six.iteritems/keys achieve iterators. We can use
dict.items/keys instead, as it will return iterators in PY3 as well.
And dict.items/keys will more readable.
In py2, the performance about list should be negligible, see
https://wiki.openstack.org/wiki/Python3 and
http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: I8cdac1b75918094b9b3acbc65d53d231e86eca19
-rw-r--r-- | oslo_i18n/_gettextutils.py | 3 | ||||
-rw-r--r-- | oslo_i18n/_translate.py | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/oslo_i18n/_gettextutils.py b/oslo_i18n/_gettextutils.py index 75a8313..8d78376 100644 --- a/oslo_i18n/_gettextutils.py +++ b/oslo_i18n/_gettextutils.py @@ -22,7 +22,6 @@ import gettext import os from babel import localedata -import six from oslo_i18n import _factory from oslo_i18n import _locale @@ -82,7 +81,7 @@ def get_available_languages(domain): 'zh_Hant': 'zh_TW', 'fil': 'tl_PH'} - language_list.extend(alias for locale, alias in six.iteritems(aliases) + language_list.extend(alias for locale, alias in aliases.items() if (locale in language_list and alias not in language_list)) diff --git a/oslo_i18n/_translate.py b/oslo_i18n/_translate.py index 1809e1e..4592196 100644 --- a/oslo_i18n/_translate.py +++ b/oslo_i18n/_translate.py @@ -68,6 +68,6 @@ def translate_args(args, desired_locale=None): return tuple(translate(v, desired_locale) for v in args) if isinstance(args, dict): translated_dict = dict((key, translate(value, desired_locale)) - for key, value in six.iteritems(args)) + for key, value in args.items()) return translated_dict return translate(args, desired_locale) |