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
This commit is contained in:
parent
b22d9628d0
commit
d99353c44d
@ -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))
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user