Import i18n functions directly

Import i18n functions from module directly and do not use
global module variables like _ = i18n._. It makes code shorter
and cleaner. It also to detect cases when these functions are not
used in module.

Change-Id: Iaa593ac1f2dd15cbcad049bef6ba68f1cfa610da
This commit is contained in:
kairat_kushaev 2015-09-29 14:39:41 +03:00
parent a33b20b92b
commit c27c25f779
100 changed files with 103 additions and 319 deletions

View File

@ -18,9 +18,7 @@ import copy
from glance.common import exception
import glance.domain.proxy
from glance import i18n
_ = i18n._
from glance.i18n import _
def is_image_mutable(context, image):

View File

@ -23,12 +23,9 @@ from oslo_utils import units
from glance.common import exception
from glance.common import wsgi
from glance import i18n
from glance.i18n import _, _LE, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LW = i18n._LW
CONF = cfg.CONF
_CACHED_THREAD_POOL = {}

View File

@ -34,14 +34,12 @@ from glance.common import exception
from glance.common import utils
from glance.common import wsgi
import glance.db
from glance import i18n
from glance.i18n import _LE, _LI
from glance import image_cache
from glance import notifier
import glance.registry.client.v1.api as registry
LOG = logging.getLogger(__name__)
_LI = i18n._LI
_LE = i18n._LE
PATTERNS = {
('v1', 'GET'): re.compile(r'^/v1/images/([^\/]+)$'),

View File

@ -22,10 +22,9 @@ import routes
from glance.api import cached_images
from glance.common import wsgi
from glance import i18n
from glance.i18n import _LI
LOG = logging.getLogger(__name__)
_LI = i18n._LI
class CacheManageFilter(wsgi.Middleware):

View File

@ -21,9 +21,8 @@ import webob.exc
from glance.api import policy
from glance.common import wsgi
import glance.context
from glance import i18n
from glance.i18n import _
_ = i18n._
context_opts = [
cfg.BoolOpt('owner_is_tenant', default=True,

View File

@ -22,10 +22,9 @@ import re
from oslo_log import log as logging
from glance.common import wsgi
from glance import i18n
from glance.i18n import _LI
LOG = logging.getLogger(__name__)
_LI = i18n._LI
class GzipMiddleware(wsgi.Middleware):

View File

@ -24,13 +24,10 @@ from oslo_log import log as logging
from glance.api import versions
from glance.common import wsgi
from glance import i18n
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
_ = i18n._
_LW = i18n._LW
class VersionNegotiationFilter(wsgi.Middleware):

View File

@ -24,7 +24,7 @@ from oslo_policy import policy
from glance.common import exception
import glance.domain.proxy
from glance import i18n
from glance.i18n import _
LOG = logging.getLogger(__name__)
@ -36,8 +36,6 @@ DEFAULT_RULES = policy.Rules.from_dict({
'manage_image_cache': 'role:admin',
})
_ = i18n._
class Enforcer(policy.Enforcer):
"""Responsible for loading and enforcing rules"""

View File

@ -18,12 +18,11 @@ from oslo_log import log as logging
import webob.exc
from glance.common import exception
from glance import i18n
from glance.i18n import _
import glance.registry.client.v1.api as registry
LOG = logging.getLogger(__name__)
_ = i18n._
class BaseController(object):

View File

@ -47,16 +47,12 @@ from glance.common import property_utils
from glance.common import store_utils
from glance.common import utils
from glance.common import wsgi
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
from glance import notifier
import glance.registry.client.v1.api as registry
from oslo_utils import timeutils
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
SUPPORTED_PARAMS = glance.api.v1.SUPPORTED_PARAMS
SUPPORTED_FILTERS = glance.api.v1.SUPPORTED_FILTERS
ACTIVE_IMMUTABLE = glance.api.v1.ACTIVE_IMMUTABLE

View File

@ -24,11 +24,10 @@ from glance.api.v1 import controller
from glance.common import exception
from glance.common import utils
from glance.common import wsgi
from glance import i18n
from glance.i18n import _
import glance.registry.client.v1.api as registry
LOG = logging.getLogger(__name__)
_ = i18n._
CONF = cfg.CONF
CONF.import_opt('image_member_quota', 'glance.common.config')

View File

@ -23,15 +23,12 @@ from glance.common import exception
from glance.common import store_utils
from glance.common import utils
import glance.db
from glance import i18n
from glance.i18n import _, _LE, _LI
import glance.registry.client.v1.api as registry
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
def initiate_deletion(req, location_data, id):

View File

@ -22,13 +22,11 @@ from glance.common import utils
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _LI
import glance.notifier
LOG = logging.getLogger(__name__)
_ = i18n._
_LI = i18n._LI
class ImageActionsController(object):

View File

@ -24,13 +24,11 @@ from glance.common import utils
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _, _LE
import glance.notifier
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
class ImageDataController(object):

View File

@ -29,13 +29,12 @@ from glance.common import utils
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
class ImageMembersController(object):

View File

@ -23,12 +23,11 @@ from glance.common import utils
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _
import glance.notifier
LOG = logging.getLogger(__name__)
_ = i18n._
class Controller(object):

View File

@ -32,13 +32,11 @@ from glance.common import utils
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _, _LW
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
_LW = i18n._LW
CONF = cfg.CONF
CONF.import_opt('disk_formats', 'glance.common.config', group='image_format')

View File

@ -35,13 +35,11 @@ from glance.common import wsgi
from glance.common import wsme_utils
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _, _LE
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
CONF = cfg.CONF

View File

@ -29,12 +29,11 @@ from glance.common import exception
from glance.common import wsgi
from glance.common import wsme_utils
import glance.db
from glance import i18n
from glance.i18n import _
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
CONF = cfg.CONF

View File

@ -29,12 +29,11 @@ from glance.common import exception
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
class NamespacePropertiesController(object):

View File

@ -29,12 +29,11 @@ from glance.common import exception
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
class ResourceTypeController(object):

View File

@ -28,14 +28,11 @@ from glance.common import exception
from glance.common import wsgi
from glance.common import wsme_utils
import glance.db
from glance import i18n
from glance.i18n import _
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
CONF = cfg.CONF

View File

@ -33,13 +33,11 @@ from glance.common import exception
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _, _LW
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
_LW = i18n._LW
CONF = cfg.CONF
CONF.import_opt('task_time_to_live', 'glance.common.config', group='task')

View File

@ -35,12 +35,10 @@ from glance.common import jsonpatchvalidator
from glance.common import utils
from glance.common import wsgi
import glance.db
from glance import i18n
from glance.i18n import _, _LE
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
_LE = i18n._LE
_ = i18n._
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,

View File

@ -20,9 +20,8 @@ from six.moves import http_client
import webob.dec
from glance.common import wsgi
from glance import i18n
from glance.i18n import _
_ = i18n._
versions_opts = [
cfg.StrOpt('public_endpoint',

View File

@ -15,9 +15,7 @@
from glance.artifacts.domain import proxy
import glance.common.artifacts.definitions as definitions
import glance.common.exception as exc
from glance import i18n
_ = i18n._
from glance.i18n import _
class ArtifactProxy(proxy.Artifact):

View File

@ -16,9 +16,7 @@ import uuid
from oslo_utils import timeutils
from glance import i18n
_ = i18n._
from glance.i18n import _
class Artifact(object):

View File

@ -22,11 +22,7 @@ from oslo_utils import encodeutils
from glance.artifacts.domain import proxy
from glance.common.artifacts import definitions
from glance.common import utils
from glance import i18n
_ = i18n._
_LE = i18n._LE
_LW = i18n._LW
from glance.i18n import _, _LE, _LW
CONF = cfg.CONF
LOG = logging.getLogger(__name__)

View File

@ -14,9 +14,7 @@
from glance.artifacts.domain import proxy
from glance.common import exception as exc
from glance import i18n
_ = i18n._
from glance.i18n import _
class ArtifactProxy(proxy.Artifact):

View File

@ -15,11 +15,10 @@
from oslo_log import log as logging
from glance import i18n
from glance.i18n import _LE
LOG = logging.getLogger(__name__)
_LE = i18n._LE
class TaskExecutor(object):

View File

@ -33,13 +33,10 @@ from taskflow.types import failure
from glance.common import exception
from glance.common.scripts.image_import import main as image_import
from glance.common.scripts import utils as script_utils
from glance import i18n
from glance.i18n import _, _LE, _LI
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
CONF = cfg.CONF

View File

@ -21,12 +21,8 @@ from oslo_config import cfg
from taskflow.patterns import linear_flow as lf
from taskflow import task
from glance import i18n
from glance.i18n import _, _LW
_ = i18n._
_LI = i18n._LI
_LE = i18n._LE
_LW = i18n._LW
LOG = logging.getLogger(__name__)
convert_task_opts = [

View File

@ -21,10 +21,9 @@ from oslo_utils import excutils
from taskflow.patterns import linear_flow as lf
from glance.async import utils
from glance import i18n
from glance.i18n import _LE
_LE = i18n._LE
LOG = logging.getLogger(__name__)

View File

@ -28,10 +28,8 @@ from taskflow.listeners import logging as llistener
import glance.async
from glance.common import exception
from glance.common.scripts import utils as script_utils
from glance import i18n
from glance.i18n import _, _LE
_ = i18n._
_LE = i18n._LE
LOG = logging.getLogger(__name__)
_deprecated_opt = cfg.DeprecatedOpt('eventlet_executor_pool_size',

View File

@ -17,11 +17,10 @@ from oslo_log import log as logging
import six
from taskflow import task
from glance import i18n
from glance.i18n import _LW
LOG = logging.getLogger(__name__)
_LW = i18n._LW
class OptionalTask(task.Task):

View File

@ -44,7 +44,7 @@ def fix_greendns_ipv6():
"if using ipv6 since eventlet.greendns currently "
"breaks with ipv6 addresses. Please ensure that "
"eventlet is not imported prior to this being set.")
raise ImportError(msg % (nogreendns))
raise ImportError(msg % nogreendns)
os.environ[nogreendns] = 'yes'

View File

@ -45,9 +45,7 @@ from oslo_utils import units
from six.moves import range
from glance.common import config
from glance import i18n
_ = i18n._
from glance.i18n import _
CONF = cfg.CONF

View File

@ -49,12 +49,11 @@ from glance.common import exception
from glance.db import migration as db_migration
from glance.db.sqlalchemy import api as db_api
from glance.db.sqlalchemy import metadata
from glance import i18n
from glance.i18n import _
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
_ = i18n._
# Decorators for actions

View File

@ -34,13 +34,9 @@ from webob import exc
from glance.common import config
from glance.common import exception
from glance.common import utils
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LI = i18n._LI
_LE = i18n._LE
_LW = i18n._LW
# NOTE: positional arguments <args> will be parsed before <command> until

View File

@ -19,10 +19,7 @@ import semantic_version
import six
from glance.common import exception as exc
from glance import i18n
_ = i18n._
from glance.i18n import _
class AttributeDefinition(object):

View File

@ -21,10 +21,7 @@ import six
from glance.common.artifacts import declarative
import glance.common.exception as exc
from glance import i18n
_ = i18n._
from glance.i18n import _
class Text(declarative.PropertyDefinition):

View File

@ -21,15 +21,10 @@ from stevedore import enabled
from glance.common.artifacts import definitions
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LW = i18n._LW
_LI = i18n._LI
plugins_opts = [
cfg.BoolOpt('load_enabled', default=True,

View File

@ -20,11 +20,9 @@ from glance import artifacts as ga
from glance.common.artifacts import declarative
from glance.common.artifacts import definitions
from glance.common import exception
from glance import i18n
from glance.i18n import _
_ = i18n._
COMMON_ARTIFACT_PROPERTIES = ['id',
'type_name',
'type_version',

View File

@ -36,11 +36,10 @@ from six.moves import range
import six.moves.urllib.parse as urlparse
from glance.common import exception
from glance import i18n
from glance.i18n import _
LOG = logging.getLogger(__name__)
_ = i18n._
class BaseStrategy(object):
@ -126,7 +125,7 @@ class KeystoneStrategy(BaseStrategy):
self.check_auth_params()
auth_url = self.creds['auth_url']
for _ in range(self.MAX_REDIRECTS):
for redirect_iter in range(self.MAX_REDIRECTS):
try:
_authenticate(auth_url)
except exception.AuthorizationRedirect as e:

View File

@ -50,10 +50,9 @@ import six.moves.urllib.parse as urlparse
from glance.common import auth
from glance.common import exception
from glance.common import utils
from glance import i18n
from glance.i18n import _
LOG = logging.getLogger(__name__)
_ = i18n._
# common chunk size for get and put
CHUNKSIZE = 65536
@ -83,7 +82,7 @@ def handle_redirects(func):
@functools.wraps(func)
def wrapped(self, method, url, body, headers):
for _ in range(MAX_REDIRECTS):
for i in range(MAX_REDIRECTS):
try:
return func(self, method, url, body, headers)
except exception.RedirectException as redirect:

View File

@ -28,11 +28,9 @@ from oslo_config import cfg
from oslo_policy import policy
from paste import deploy
from glance import i18n
from glance.i18n import _
from glance.version import version_info as version
_ = i18n._
paste_deploy_opts = [
cfg.StrOpt('flavor',
help=_('Partial name of a pipeline in your paste configuration '

View File

@ -19,9 +19,7 @@
import six
import six.moves.urllib.parse as urlparse
from glance import i18n
_ = i18n._
from glance.i18n import _
_FATAL_EXCEPTION_FORMAT_ERRORS = False

View File

@ -24,9 +24,7 @@ import re
import jsonschema
import glance.common.exception as exc
from glance import i18n
_ = i18n._
from glance.i18n import _
class JsonPatchValidatorMixin(object):

View File

@ -19,10 +19,7 @@ from oslo_config import cfg
from oslo_log import log as logging
import stevedore
from glance import i18n
_ = i18n._
_LE = i18n._LE
from glance.i18n import _, _LE
location_strategy_opts = [
cfg.StrOpt('location_strategy', default='location_order',

View File

@ -19,9 +19,8 @@ from oslo_config import cfg
import six
import six.moves.urllib.parse as urlparse
from glance import i18n
from glance.i18n import _
_ = i18n._
store_type_opts = [
cfg.ListOpt("store_type_preference",

View File

@ -22,14 +22,12 @@ from six.moves import configparser
import glance.api.policy
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE
# NOTE(bourke): The default dict_type is collections.OrderedDict in py27, but
# we must set manually for compatibility with py26
CONFIG = configparser.SafeConfigParser(dict_type=OrderedDict)
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
property_opts = [
cfg.StrOpt('property_protection_file',

View File

@ -30,11 +30,9 @@ from webob import exc
from glance.common import client
from glance.common import exception
from glance.common import wsgi
from glance import i18n
from glance.i18n import _, _LE
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
rpc_opts = [

View File

@ -16,11 +16,9 @@
from oslo_log import log as logging
from glance.common.scripts.image_import import main as image_import
from glance import i18n
from glance.i18n import _LE, _LI
_LI = i18n._LI
_LE = i18n._LE
LOG = logging.getLogger(__name__)

View File

@ -27,14 +27,9 @@ from glance.api.v2 import images as v2_api
from glance.common import exception
from glance.common.scripts import utils as script_utils
from glance.common import store_utils
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
def run(t_id, context, task_repo, image_repo, image_factory):

View File

@ -26,12 +26,9 @@ from oslo_log import log as logging
from six.moves import urllib
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
def get_task(task_repo, task_id):

View File

@ -19,13 +19,11 @@ from sqlalchemy.orm.properties import CompositeProperty
from sqlalchemy import sql
from glance.common import exception
from glance import i18n
from glance.i18n import _
MAX_COMPONENT_LENGTH = pow(2, 16) - 1
MAX_NUMERIC_PRERELEASE_LENGTH = 6
_ = i18n._
class DBVersion(object):
def __init__(self, components_long, prerelease, build):

View File

@ -31,11 +31,9 @@ from oslo_utils import encodeutils
import six
from glance.common import exception
from glance import i18n
from glance.i18n import _LE
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
# Note: This is the signature hash method, which is independent from the

View File

@ -21,13 +21,10 @@ from oslo_utils import encodeutils
import six.moves.urllib.parse as urlparse
import glance.db as db_api
from glance import i18n
from glance.i18n import _LE, _LW
from glance import scrubber
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LW = i18n._LW
CONF = cfg.CONF

View File

@ -18,10 +18,7 @@ from oslo_log import log as logging
from six.moves import configparser
from glance.common import exception
from glance import i18n
_ = i18n._
_LE = i18n._LE
from glance.i18n import _, _LE
swift_opts = [
cfg.StrOpt('default_swift_reference',

View File

@ -43,13 +43,11 @@ import six
from webob import exc
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
# Whitelist of v1 API headers of form x-image-meta-xxx
IMAGE_META_HEADERS = ['x-image-meta-location', 'x-image-meta-size',
@ -376,7 +374,7 @@ class PrettyTable(object):
def make_header(self):
label_parts = []
break_parts = []
for width, label, _ in self.columns:
for width, label, just in self.columns:
# NOTE(sirp): headers are always left justified
label_part = self._clip_and_justify(label, width, 'l')
label_parts.append(label_part)
@ -391,7 +389,7 @@ class PrettyTable(object):
def make_row(self, *args):
row = args
row_parts = []
for data, (width, _, just) in zip(row, self.columns):
for data, (width, label, just) in zip(row, self.columns):
row_part = self._clip_and_justify(data, width, just)
row_parts.append(row_part)

View File

@ -48,13 +48,9 @@ from webob import multidict
from glance.common import exception
from glance.common import utils
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
bind_opts = [
cfg.StrOpt('bind_host', default='0.0.0.0',
help=_('Address to bind the server. Useful when '

View File

@ -19,10 +19,7 @@ import glance.contrib.plugins.image_artifact.v1_1.image as v1_1
import glanceclient
from glance import i18n
_ = i18n._
from glance.i18n import _
class ImageAsAnArtifact(v1_1.ImageAsAnArtifact):

View File

@ -29,9 +29,7 @@ from glance.common import exception
from glance.common import location_strategy
import glance.domain
import glance.domain.proxy
from glance import i18n
_ = i18n._
from glance.i18n import _
CONF = cfg.CONF
CONF.import_opt('image_size_cap', 'glance.common.config')

View File

@ -25,12 +25,10 @@ import six
from glance.common import exception
from glance.common import utils
from glance import i18n
from glance.i18n import _, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LI = i18n._LI
_LW = i18n._LW
DATA = {
'images': {},

View File

@ -50,13 +50,11 @@ from glance.db.sqlalchemy.metadef_api import object as metadef_object_api
from glance.db.sqlalchemy.metadef_api import property as metadef_property_api
from glance.db.sqlalchemy.metadef_api import tag as metadef_tag_api
from glance.db.sqlalchemy import models
from glance import i18n
from glance.i18n import _, _LW
BASE = models.BASE
sa_logger = None
LOG = logging.getLogger(__name__)
_ = i18n._
_LW = i18n._LW
STATUSES = ['active', 'saving', 'queued', 'killed', 'pending_delete',

View File

@ -31,12 +31,10 @@ import glance.artifacts as ga
from glance.common import exception
from glance.common import semver_db
from glance.db.sqlalchemy import models_artifacts as models
from glance import i18n
from glance.i18n import _LE, _LW
from oslo_log import log as os_logging
LOG = os_logging.getLogger(__name__)
_LW = i18n._LW
_LE = i18n._LE
CONF = cfg.CONF

View File

@ -33,13 +33,9 @@ from sqlalchemy import and_
from sqlalchemy.schema import MetaData
from sqlalchemy.sql import select
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LW = i18n._LW
_LI = i18n._LI
metadata_opts = [
cfg.StrOpt('metadata_source_path', default='/etc/glance/metadefs/',

View File

@ -22,10 +22,9 @@ import sqlalchemy.orm as sa_orm
from glance.common import exception as exc
import glance.db.sqlalchemy.metadef_api as metadef_api
from glance.db.sqlalchemy import models_metadef as models
from glance import i18n
from glance.i18n import _
LOG = logging.getLogger(__name__)
_ = i18n._
def _is_namespace_visible(context, namespace, status=None):

View File

@ -22,10 +22,9 @@ from glance.common import exception as exc
from glance.db.sqlalchemy.metadef_api import namespace as namespace_api
import glance.db.sqlalchemy.metadef_api.utils as metadef_utils
from glance.db.sqlalchemy import models_metadef as models
from glance import i18n
from glance.i18n import _
LOG = logging.getLogger(__name__)
_ = i18n._
def _get(context, object_id, session):

View File

@ -22,10 +22,9 @@ from glance.common import exception as exc
from glance.db.sqlalchemy.metadef_api import namespace as namespace_api
from glance.db.sqlalchemy.metadef_api import utils as metadef_utils
from glance.db.sqlalchemy import models_metadef as models
from glance import i18n
from glance.i18n import _
LOG = logging.getLogger(__name__)
_ = i18n._
def _get(context, property_id, session):

View File

@ -23,10 +23,9 @@ from glance.common import exception as exc
from glance.db.sqlalchemy.metadef_api import namespace as namespace_api
import glance.db.sqlalchemy.metadef_api.utils as metadef_utils
from glance.db.sqlalchemy import models_metadef as models
from glance import i18n
from glance.i18n import _LW
LOG = logging.getLogger(__name__)
_LW = i18n._LW
def _get(context, id, session):

View File

@ -20,11 +20,10 @@ Various conveniences used for migration scripts
from oslo_log import log as logging
import sqlalchemy.types
from glance import i18n
from glance.i18n import _LI
LOG = logging.getLogger(__name__)
_LI = i18n._LI
String = lambda length: sqlalchemy.types.String(

View File

@ -19,11 +19,9 @@ import six.moves.urllib.parse as urlparse
import sqlalchemy
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
def upgrade(migrate_engine):

View File

@ -36,13 +36,9 @@ import sqlalchemy
from glance.common import crypt
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
CONF = cfg.CONF
CONF.import_opt('metadata_encryption_key', 'glance.common.config')

View File

@ -33,12 +33,10 @@ from sqlalchemy import Text
import glance.artifacts as ga
from glance.common import semver_db
from glance import i18n
from oslo_log import log as os_logging
BASE = declarative.declarative_base()
LOG = os_logging.getLogger(__name__)
_LW = i18n._LW
class ArtifactBase(models.ModelBase, models.TimestampMixin):

View File

@ -26,12 +26,8 @@ from oslo_utils import timeutils
import six
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('task_executor', 'glance.common.config', group='task')

View File

@ -28,13 +28,9 @@ from oslo_utils import units
from glance.common import exception
from glance.common import utils
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
image_cache_opts = [
cfg.StrOpt('image_cache_driver', default='sqlite',

View File

@ -19,9 +19,7 @@ from oslo_serialization import jsonutils as json
from glance.common import client as base_client
from glance.common import exception
from glance import i18n
_ = i18n._
from glance.i18n import _
class CacheClient(base_client.BaseClient):

View File

@ -24,10 +24,9 @@ from oslo_log import log as logging
from glance.common import exception
from glance.common import utils
from glance import i18n
from glance.i18n import _
LOG = logging.getLogger(__name__)
_ = i18n._
CONF = cfg.CONF

View File

@ -31,14 +31,10 @@ from oslo_log import log as logging
from oslo_utils import excutils
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
from glance.image_cache.drivers import base
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
sqlite_opts = [
cfg.StrOpt('image_cache_sqlite_db', default='cache.db',

View File

@ -66,14 +66,10 @@ import six
import xattr
from glance.common import exception
from glance import i18n
from glance.i18n import _, _LI, _LW
from glance.image_cache.drivers import base
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
CONF = cfg.CONF

View File

@ -23,13 +23,11 @@ from oslo_log import log as logging
from glance.common import exception
from glance import context
from glance import i18n
from glance.i18n import _LI, _LW
from glance.image_cache import base
import glance.registry.client.v1.api as registry
LOG = logging.getLogger(__name__)
_LI = i18n._LI
_LW = i18n._LW
class Prefetcher(base.CacheApp):

View File

@ -26,13 +26,9 @@ from glance.common import exception
from glance.common import signature_utils
from glance.common import utils
import glance.domain.proxy
from glance import i18n
from glance.i18n import _, _LE, _LI
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
CONF = cfg.CONF
LOG = logging.getLogger(__name__)

View File

@ -28,10 +28,8 @@ import webob
from glance.common import exception
from glance.domain import proxy as domain_proxy
from glance import i18n
from glance.i18n import _, _LE
_ = i18n._
_LE = i18n._LE
notifier_opts = [
cfg.StrOpt('default_publisher_id', default="image.localhost",

View File

@ -25,12 +25,10 @@ import glance.common.exception as exception
from glance.common import utils
import glance.domain
import glance.domain.proxy
from glance import i18n
from glance.i18n import _, _LI
LOG = logging.getLogger(__name__)
_ = i18n._
_LI = i18n._LI
CONF = cfg.CONF
CONF.import_opt('image_member_quota', 'glance.common.config')
CONF.import_opt('image_property_quota', 'glance.common.config')

View File

@ -19,9 +19,8 @@ Registry API
from oslo_config import cfg
from glance import i18n
from glance.i18n import _
_ = i18n._
registry_addr_opts = [
cfg.StrOpt('registry_host', default='0.0.0.0',

View File

@ -29,14 +29,10 @@ from glance.common import exception
from glance.common import utils
from glance.common import wsgi
import glance.db
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
CONF = cfg.CONF

View File

@ -21,13 +21,10 @@ from glance.common import exception
from glance.common import utils
from glance.common import wsgi
import glance.db
from glance import i18n
from glance.i18n import _, _LI, _LW
LOG = logging.getLogger(__name__)
_ = i18n._
_LI = i18n._LI
_LW = i18n._LW
class Controller(object):

View File

@ -22,9 +22,8 @@ from oslo_config import cfg
from glance.common import rpc
from glance.common import wsgi
import glance.db
from glance import i18n
from glance.i18n import _
_ = i18n._
CONF = cfg.CONF

View File

@ -15,9 +15,8 @@
from oslo_config import cfg
from glance import i18n
from glance.i18n import _
_ = i18n._
registry_client_opts = [
cfg.StrOpt('registry_client_protocol', default='http',

View File

@ -24,11 +24,10 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
from glance.common import exception
from glance import i18n
from glance.i18n import _
from glance.registry.client.v1 import client
LOG = logging.getLogger(__name__)
_ = i18n._
registry_client_ctx_opts = [
cfg.BoolOpt('send_identity_headers', default=False,

View File

@ -24,11 +24,10 @@ from oslo_utils import excutils
from glance.common.client import BaseClient
from glance.common import crypt
from glance import i18n
from glance.i18n import _LE
from glance.registry.api.v1 import images
LOG = logging.getLogger(__name__)
_LE = i18n._LE
class RegistryClient(BaseClient):

View File

@ -23,11 +23,10 @@ from oslo_config import cfg
from oslo_log import log as logging
from glance.common import exception
from glance import i18n
from glance.i18n import _
from glance.registry.client.v2 import client
LOG = logging.getLogger(__name__)
_ = i18n._
CONF = cfg.CONF
_registry_client = 'glance.registry.client'

View File

@ -18,9 +18,7 @@ from oslo_utils import encodeutils
import six
from glance.common import exception
from glance import i18n
_ = i18n._
from glance.i18n import _
class Schema(object):

View File

@ -27,16 +27,11 @@ from glance.common import crypt
from glance.common import exception
from glance import context
import glance.db as db_api
from glance import i18n
from glance.i18n import _, _LE, _LI, _LW
import glance.registry.client.v1.api as registry
LOG = logging.getLogger(__name__)
_ = i18n._
_LI = i18n._LI
_LW = i18n._LW
_LE = i18n._LE
scrubber_opts = [
cfg.IntOpt('scrub_time', default=0,
help=_('The amount of time in seconds to delay before '

View File

@ -29,14 +29,11 @@ from glance.common import exception
from glance.common import wsgi
import glance.db
import glance.gateway
from glance import i18n
from glance.i18n import _, _LE
import glance.notifier
import glance.schema
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
class ResourceTypeController(object):

View File

@ -53,9 +53,7 @@ from glance.db.sqlalchemy import models
from glance.db.sqlalchemy import models_artifacts
from glance.db.sqlalchemy import models_metadef
from glance import i18n
_ = i18n._
from glance.i18n import _
CONF = cfg.CONF
CONF.import_opt('metadata_encryption_key', 'glance.common.config')

View File

@ -32,15 +32,13 @@ from glance.common import config
from glance.common import exception
from glance import context
from glance.db.sqlalchemy import api as db_api
from glance import i18n
from glance.i18n import _
from glance.registry.api import v2 as rserver
import glance.registry.client.v2.api as rapi
from glance.registry.client.v2.api import client as rclient
from glance.tests.unit import base
from glance.tests import utils as test_utils
_ = i18n._
_gen_uuid = lambda: str(uuid.uuid4())
UUID1 = str(uuid.uuid4())

View File

@ -21,13 +21,9 @@ from oslo_log import log as logging
import glance.context
import glance.db.sqlalchemy.api as db_api
from glance import i18n
from glance.i18n import _LC, _LE, _LI
import glance.registry.context
_ = i18n._
_LC = i18n._LC
_LE = i18n._LE
_LI = i18n._LI
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.StreamHandler())

View File

@ -154,3 +154,4 @@ exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*lib/python*,*egg,build
[hacking]
local-check-factory = glance.hacking.checks.factory
import_exceptions = glance.i18n