Graduate to oslo.i18n and cleanup incubator usage

Graduate from Oslo Incubator to oslo.i18n library.
Cleanup of unused Oslo Incubator utils.
Added optional enable_lazy() usage.

Change-Id: I5ec02477f3f52f4d7097669120581e82cced3748
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2016-10-26 19:30:18 -04:00 committed by rabi
parent 911c61fe45
commit 29d6c613f6
26 changed files with 78 additions and 76 deletions

47
heatclient/_i18n.py Normal file
View File

@ -0,0 +1,47 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""oslo.i18n integration module.
See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
import oslo_i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo_i18n.TranslatorFactory(domain='heatclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
def get_available_languages():
return oslo_i18n.get_available_languages('heatclient')
def enable_lazy():
return oslo_i18n.enable_lazy()

View File

@ -18,8 +18,8 @@ from six.moves.urllib import parse as urlparse
from swiftclient import client as sc
from swiftclient import utils as swiftclient_utils
from heatclient._i18n import _
from heatclient import exc
from heatclient.openstack.common._i18n import _
from heatclient.v1 import software_configs

View File

@ -12,8 +12,8 @@
import yaml
from heatclient._i18n import _
from heatclient.common import template_format
from heatclient.openstack.common._i18n import _
SECTIONS = (

View File

@ -15,9 +15,9 @@
import sys
import time
from heatclient._i18n import _
from heatclient.common import utils
import heatclient.exc as exc
from heatclient.openstack.common._i18n import _
def get_hook_events(hc, stack_id, event_args, nested_depth=0,

View File

@ -14,9 +14,9 @@ import logging
from oslo_utils import fnmatch
import heatclient.exc as exc
from heatclient.openstack.common._i18n import _
from heatclient.openstack.common._i18n import _LE
from heatclient._i18n import _
from heatclient._i18n import _LE
from heatclient import exc
logger = logging.getLogger(__name__)

View File

@ -27,10 +27,10 @@ import requests
import six
from six.moves.urllib import parse
from heatclient._i18n import _
from heatclient._i18n import _LW
from heatclient.common import utils
from heatclient import exc
from heatclient.openstack.common._i18n import _
from heatclient.openstack.common._i18n import _LW
LOG = logging.getLogger(__name__)
USER_AGENT = 'python-heatclient'

View File

@ -13,7 +13,7 @@
import json
import yaml
from heatclient.openstack.common._i18n import _
from heatclient._i18n import _
if hasattr(yaml, 'CSafeLoader'):
yaml_loader = yaml.CSafeLoader

View File

@ -20,11 +20,11 @@ from six.moves.urllib import error
from six.moves.urllib import parse
from six.moves.urllib import request
from heatclient._i18n import _
from heatclient.common import environment_format
from heatclient.common import template_format
from heatclient.common import utils
from heatclient import exc
from heatclient.openstack.common._i18n import _
def process_template_path(template_path, object_request=None, existing=False):

View File

@ -29,9 +29,9 @@ from six.moves.urllib import parse
from six.moves.urllib import request
import yaml
from heatclient._i18n import _
from heatclient._i18n import _LE
from heatclient import exc
from heatclient.openstack.common._i18n import _
from heatclient.openstack.common._i18n import _LE
from heatclient.openstack.common import cliutils
LOG = logging.getLogger(__name__)

View File

@ -15,7 +15,7 @@ import sys
from oslo_serialization import jsonutils
from oslo_utils import reflection
from heatclient.openstack.common._i18n import _
from heatclient._i18n import _
verbose = 0

View File

@ -1,45 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""oslo.i18n integration module.
See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
try:
import oslo_i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo_i18n.TranslatorFactory(domain='heatclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
except ImportError:
# NOTE(dims): Support for cases where a project wants to use
# code from oslo-incubator, but is not ready to be internationalized
# (like tempest)
_ = _LI = _LW = _LE = _LC = lambda x: x

View File

@ -46,7 +46,7 @@ from oslo_utils import strutils
import six
from six.moves.urllib import parse
from heatclient.openstack.common._i18n import _, _LW
from heatclient._i18n import _, _LW
from heatclient.openstack.common.apiclient import exceptions
LOG = logging.getLogger(__name__)

View File

@ -38,7 +38,7 @@ from oslo_utils import encodeutils
from oslo_utils import importutils
import requests
from heatclient.openstack.common._i18n import _
from heatclient._i18n import _
from heatclient.openstack.common.apiclient import exceptions
_logger = logging.getLogger(__name__)

View File

@ -38,7 +38,7 @@ import sys
import six
from heatclient.openstack.common._i18n import _
from heatclient._i18n import _
class ClientException(Exception):

View File

@ -28,7 +28,7 @@ from oslo_utils import encodeutils
from oslo_utils import uuidutils
import six
from heatclient.openstack.common._i18n import _
from heatclient._i18n import _
from heatclient.openstack.common.apiclient import exceptions

View File

@ -30,7 +30,7 @@ import prettytable
import six
from six import moves
from heatclient.openstack.common._i18n import _
from heatclient._i18n import _
class MissingArgs(Exception):

View File

@ -19,10 +19,10 @@ from cliff.formatters import base
from osc_lib.command import command
from osc_lib import utils
from heatclient._i18n import _
from heatclient.common import event_utils
from heatclient.common import utils as heat_utils
from heatclient import exc
from heatclient.openstack.common._i18n import _
class ShowEvent(command.ShowOne):

View File

@ -22,11 +22,11 @@ import six
from six.moves.urllib import request
import yaml
from heatclient._i18n import _
from heatclient.common import format_utils
from heatclient.common import template_format
from heatclient.common import utils as heat_utils
from heatclient import exc as heat_exc
from heatclient.openstack.common._i18n import _
class DeleteConfig(command.Command):

View File

@ -20,11 +20,11 @@ from osc_lib import exceptions as exc
from osc_lib import utils
from oslo_serialization import jsonutils
from heatclient._i18n import _
from heatclient.common import deployment_utils
from heatclient.common import format_utils
from heatclient.common import utils as heat_utils
from heatclient import exc as heat_exc
from heatclient.openstack.common._i18n import _
class CreateDeployment(format_utils.YamlFormat):

View File

@ -24,6 +24,8 @@ from oslo_serialization import jsonutils
import six
from six.moves.urllib import request
from heatclient._i18n import _
from heatclient._i18n import _LI
from heatclient.common import event_utils
from heatclient.common import format_utils
from heatclient.common import hook_utils
@ -31,8 +33,6 @@ from heatclient.common import http
from heatclient.common import template_utils
from heatclient.common import utils as heat_utils
from heatclient import exc as heat_exc
from heatclient.openstack.common._i18n import _
from heatclient.openstack.common._i18n import _LI
class CreateStack(command.ShowOne):

View File

@ -16,9 +16,9 @@ import collections
from osc_lib.command import command
from heatclient._i18n import _
from heatclient.common import format_utils
from heatclient import exc
from heatclient.openstack.common._i18n import _
class ListStackFailures(command.Command):

View File

@ -18,12 +18,12 @@ from osc_lib.command import command
from osc_lib import utils
import six
from heatclient._i18n import _
from heatclient.common import format_utils
from heatclient.common import http
from heatclient.common import template_utils
from heatclient.common import utils as heat_utils
from heatclient import exc
from heatclient.openstack.common._i18n import _
class VersionList(command.Lister):

View File

@ -27,10 +27,10 @@ from oslo_utils import importutils
import six
import heatclient
from heatclient._i18n import _
from heatclient import client as heat_client
from heatclient.common import utils
from heatclient import exc
from heatclient.openstack.common._i18n import _
logger = logging.getLogger(__name__)
osprofiler_profiler = importutils.try_import("osprofiler.profiler")

View File

@ -22,6 +22,9 @@ import six
from six.moves.urllib import request
import yaml
from heatclient._i18n import _
from heatclient._i18n import _LI
from heatclient._i18n import _LW
from heatclient.common import deployment_utils
from heatclient.common import event_utils
from heatclient.common import hook_utils
@ -30,9 +33,6 @@ from heatclient.common import template_format
from heatclient.common import template_utils
from heatclient.common import utils
import heatclient.exc as exc
from heatclient.openstack.common._i18n import _
from heatclient.openstack.common._i18n import _LI
from heatclient.openstack.common._i18n import _LW
logger = logging.getLogger(__name__)

View File

@ -16,9 +16,9 @@
import six
from six.moves.urllib import parse
from heatclient._i18n import _
from heatclient.common import utils
from heatclient import exc
from heatclient.openstack.common._i18n import _
from heatclient.openstack.common.apiclient import base

View File

@ -54,4 +54,4 @@ exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build
max-complexity=20
[hacking]
import_exceptions = heatclient.openstack.common._i18n
import_exceptions = heatclient._i18n