diff --git a/watcher/_i18n.py b/watcher/_i18n.py index d7a1b7374..b410850b4 100644 --- a/watcher/_i18n.py +++ b/watcher/_i18n.py @@ -32,16 +32,6 @@ _C = _translators.contextual_form # The plural translation function using the name "_P" _P = _translators.plural_form -# 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 lazy_translation_enabled(): return _lazy.USE_LAZY diff --git a/watcher/api/scheduling.py b/watcher/api/scheduling.py index 035c6d2d4..4a2b0538d 100644 --- a/watcher/api/scheduling.py +++ b/watcher/api/scheduling.py @@ -21,7 +21,6 @@ from oslo_log import log from oslo_utils import timeutils import six -from watcher._i18n import _LW from watcher.common import context as watcher_context from watcher.common import scheduling from watcher import notifications @@ -67,9 +66,8 @@ class APISchedulingService(scheduling.BackgroundSchedulerService): elapsed = timeutils.delta_seconds(last_heartbeat, timeutils.utcnow()) is_up = abs(elapsed) <= CONF.service_down_time if not is_up: - LOG.warning(_LW('Seems service %(name)s on host %(host)s is down. ' - 'Last heartbeat was %(lhb)s.' - 'Elapsed time is %(el)s'), + LOG.warning('Seems service %(name)s on host %(host)s is down. ' + 'Last heartbeat was %(lhb)s. Elapsed time is %(el)s', {'name': service.name, 'host': service.host, 'lhb': str(last_heartbeat), 'el': str(elapsed)}) diff --git a/watcher/hacking/checks.py b/watcher/hacking/checks.py index a9e3371a1..6d4fab130 100644 --- a/watcher/hacking/checks.py +++ b/watcher/hacking/checks.py @@ -15,8 +15,6 @@ import os import re -import pep8 - def flake8ext(f): """Decorator to indicate flake8 extension. @@ -58,29 +56,12 @@ def _regex_for_level(level, hint): } -log_translation_hint = re.compile( - '|'.join('(?:%s)' % _regex_for_level(level, hint) - for level, hint in _all_log_levels.items())) - log_warn = re.compile( r"(.)*LOG\.(warn)\(\s*('|\"|_)") unittest_imports_dot = re.compile(r"\bimport[\s]+unittest\b") unittest_imports_from = re.compile(r"\bfrom[\s]+unittest\b") -@flake8ext -def validate_log_translations(logical_line, physical_line, filename): - # Translations are not required in the test directory - if "watcher/tests" in filename: - return - if pep8.noqa(physical_line): - return - - msg = "N320: Log messages require translation hints!" - if log_translation_hint.match(logical_line): - yield (0, msg) - - @flake8ext def use_jsonutils(logical_line, filename): msg = "N321: jsonutils.%(fun)s must be used instead of json.%(fun)s" @@ -291,7 +272,6 @@ def check_builtins_gettext(logical_line, tokens, filename, lines, noqa): def factory(register): - register(validate_log_translations) register(use_jsonutils) register(check_assert_called_once_with) register(no_translate_debug_logs)