Change oslo.i18n to oslo_i18n
The oslo libraries are moving away from namespace packages. bp drop-namespace-packages Change-Id: I5b6bb46ac55b8309845fcc8b01d93d97be4e86ca
This commit is contained in:
parent
a333c56ac9
commit
750d5a39dc
|
@ -24,8 +24,9 @@ import re
|
||||||
|
|
||||||
def check_oslo_namespace_imports(logical_line, blank_before, filename):
|
def check_oslo_namespace_imports(logical_line, blank_before, filename):
|
||||||
oslo_namespace_imports = re.compile(
|
oslo_namespace_imports = re.compile(
|
||||||
r"(((from)|(import))\s+oslo\.((config)|(serialization)|(utils)))|"
|
r"(((from)|(import))\s+oslo\."
|
||||||
"(from\s+oslo\s+import\s+((config)|(serialization)|(utils)))")
|
"((config)|(serialization)|(utils)|(i18n)))|"
|
||||||
|
"(from\s+oslo\s+import\s+((config)|(serialization)|(utils)|(i18n)))")
|
||||||
|
|
||||||
if re.match(oslo_namespace_imports, logical_line):
|
if re.match(oslo_namespace_imports, logical_line):
|
||||||
msg = ("K333: '%s' must be used instead of '%s'.") % (
|
msg = ("K333: '%s' must be used instead of '%s'.") % (
|
||||||
|
|
|
@ -18,10 +18,10 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html .
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from oslo import i18n
|
import oslo_i18n
|
||||||
|
|
||||||
|
|
||||||
_translators = i18n.TranslatorFactory(domain='keystoneclient')
|
_translators = oslo_i18n.TranslatorFactory(domain='keystoneclient')
|
||||||
|
|
||||||
# The primary translation function using the well-known name "_"
|
# The primary translation function using the well-known name "_"
|
||||||
_ = _translators.primary
|
_ = _translators.primary
|
||||||
|
|
|
@ -567,6 +567,14 @@ class HackingCode(fixtures.Fixture):
|
||||||
from oslo import config
|
from oslo import config
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
import oslo.i18n
|
||||||
|
import oslo_i18n
|
||||||
|
import oslo.i18n.log
|
||||||
|
import oslo_i18n.log
|
||||||
|
from oslo import i18n
|
||||||
|
from oslo.i18n import log
|
||||||
|
from oslo_i18n import log
|
||||||
""",
|
""",
|
||||||
'expected_errors': [
|
'expected_errors': [
|
||||||
(1, 0, 'K333'),
|
(1, 0, 'K333'),
|
||||||
|
@ -581,5 +589,9 @@ class HackingCode(fixtures.Fixture):
|
||||||
(19, 0, 'K333'),
|
(19, 0, 'K333'),
|
||||||
(21, 0, 'K333'),
|
(21, 0, 'K333'),
|
||||||
(22, 0, 'K333'),
|
(22, 0, 'K333'),
|
||||||
|
(25, 0, 'K333'),
|
||||||
|
(27, 0, 'K333'),
|
||||||
|
(29, 0, 'K333'),
|
||||||
|
(30, 0, 'K333'),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue