From 6b9133c9b60788e360919590309789098727c3e5 Mon Sep 17 00:00:00 2001 From: kairat_kushaev Date: Tue, 29 Sep 2015 12:08:00 +0300 Subject: [PATCH] Import i18n functions directly As stated in i18n guide it is normal to import i18n functions (_, _LW..) directly and we can include i18n functions in hacking exceptions. Also there is no need to make exceptions for six moves because pep8 passes correctly without it. Change-Id: I9c9aa490f1447bb7ae221809df7bc110c27d1336 --- glanceclient/common/utils.py | 3 +-- glanceclient/shell.py | 3 +-- tox.ini | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index 37dc43cd..bf23f2dd 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -37,10 +37,9 @@ from oslo_utils import encodeutils from oslo_utils import strutils import prettytable -from glanceclient import _i18n +from glanceclient._i18n import _ from glanceclient import exc -_ = _i18n._ _memoized_property_lock = threading.Lock() diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 7ed9e793..85889a29 100755 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -34,7 +34,7 @@ from oslo_utils import importutils import six.moves.urllib.parse as urlparse import glanceclient -from glanceclient import _i18n +from glanceclient._i18n import _ from glanceclient.common import utils from glanceclient import exc @@ -45,7 +45,6 @@ from keystoneclient.openstack.common.apiclient import exceptions as ks_exc from keystoneclient import session osprofiler_profiler = importutils.try_import("osprofiler.profiler") -_ = _i18n._ SUPPORTED_VERSIONS = [1, 2] diff --git a/tox.ini b/tox.ini index 4065c137..718cb4d3 100644 --- a/tox.ini +++ b/tox.ini @@ -45,4 +45,4 @@ show-source = True exclude = .venv*,.tox,dist,*egg,build,.git,doc,*openstack/common*,*lib/python*,.update-venv [hacking] -import_exceptions = six.moves +import_exceptions = six.moves,glanceclient._i18n