Change oslo.utils to oslo_utils

The oslo libraries are moving away from namespace packages.

A hacking check is added to enforce use of the new location.

bp drop-namespace-packages

Change-Id: I4ece3ad26c1888388a4a8839f7acf260228a9c71
changes/19/148019/6
Brant Knudson 8 years ago
parent e0a87595ba
commit fc009d7e8f
  1. 4
      keystone/auth/controllers.py
  2. 2
      keystone/auth/plugins/oauth1.py
  3. 4
      keystone/common/cache/backends/mongo.py
  4. 2
      keystone/common/cache/core.py
  5. 2
      keystone/common/kvs/core.py
  6. 2
      keystone/common/manager.py
  7. 2
      keystone/common/sql/migrate_repo/versions/042_endpoint_enabled.py
  8. 2
      keystone/common/sql/migrate_repo/versions/044_service_enabled.py
  9. 2
      keystone/common/sql/migration_helpers.py
  10. 2
      keystone/common/utils.py
  11. 4
      keystone/common/wsgi.py
  12. 2
      keystone/contrib/federation/idp.py
  13. 2
      keystone/contrib/federation/utils.py
  14. 2
      keystone/contrib/oauth1/backends/sql.py
  15. 2
      keystone/contrib/oauth1/controllers.py
  16. 2
      keystone/contrib/revoke/backends/kvs.py
  17. 2
      keystone/contrib/revoke/controllers.py
  18. 2
      keystone/contrib/revoke/core.py
  19. 2
      keystone/contrib/revoke/model.py
  20. 2
      keystone/exception.py
  21. 14
      keystone/hacking/checks.py
  22. 2
      keystone/identity/core.py
  23. 2
      keystone/models/token_model.py
  24. 18
      keystone/tests/ksfixtures/hacking.py
  25. 2
      keystone/tests/test_auth.py
  26. 2
      keystone/tests/test_backend.py
  27. 2
      keystone/tests/test_backend_kvs.py
  28. 2
      keystone/tests/test_keystoneclient.py
  29. 2
      keystone/tests/test_revoke.py
  30. 2
      keystone/tests/test_token_provider.py
  31. 2
      keystone/tests/test_v3.py
  32. 2
      keystone/tests/test_v3_auth.py
  33. 2
      keystone/tests/test_v3_os_revoke.py
  34. 10
      keystone/tests/unit/test_hacking_checks.py
  35. 2
      keystone/tests/unit/token/test_token_model.py
  36. 2
      keystone/token/controllers.py
  37. 2
      keystone/token/persistence/backends/kvs.py
  38. 2
      keystone/token/persistence/backends/sql.py
  39. 2
      keystone/token/persistence/core.py
  40. 2
      keystone/token/provider.py
  41. 2
      keystone/token/providers/common.py
  42. 2
      keystone/trust/backends/sql.py
  43. 2
      keystone/trust/controllers.py

@ -16,8 +16,8 @@ import sys
from keystoneclient.common import cms
from oslo.serialization import jsonutils
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_utils import importutils
from oslo_utils import timeutils
import six
from keystone.assignment import controllers as assignment_controllers

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone import auth
from keystone.common import controller

@ -17,8 +17,8 @@ import datetime
from dogpile.cache import api
from dogpile.cache import util as dp_util
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_utils import importutils
from oslo_utils import timeutils
import six
from keystone import exception

@ -17,7 +17,7 @@
import dogpile.cache
from dogpile.cache import proxy
from dogpile.cache import util
from oslo.utils import importutils
from oslo_utils import importutils
from keystone import config
from keystone import exception

@ -22,7 +22,7 @@ from dogpile.cache import proxy
from dogpile.cache import region
from dogpile.cache import util as dogpile_util
from dogpile.core import nameregistry
from oslo.utils import importutils
from oslo_utils import importutils
import six
from keystone.common import config

@ -14,7 +14,7 @@
import functools
from oslo.utils import importutils
from oslo_utils import importutils
def response_truncated(f):

@ -29,7 +29,7 @@ column.
"""
from oslo.serialization import jsonutils
from oslo.utils import strutils
from oslo_utils import strutils
import sqlalchemy as sql
from sqlalchemy.orm import Session

@ -29,7 +29,7 @@ column.
"""
from oslo.serialization import jsonutils
from oslo.utils import strutils
from oslo_utils import strutils
import sqlalchemy as sql
from sqlalchemy.orm import sessionmaker

@ -21,7 +21,7 @@ import migrate
from migrate import exceptions
from oslo.db.sqlalchemy import migration
from oslo.serialization import jsonutils
from oslo.utils import importutils
from oslo_utils import importutils
import six
import sqlalchemy

@ -24,7 +24,7 @@ import os
import pwd
from oslo.serialization import jsonutils
from oslo.utils import strutils
from oslo_utils import strutils
import passlib.hash
import six
from six import moves

@ -22,8 +22,8 @@ import copy
from oslo import i18n
from oslo.serialization import jsonutils
from oslo.utils import importutils
from oslo.utils import strutils
from oslo_utils import importutils
from oslo_utils import strutils
import routes.middleware
import six
import webob.dec

@ -15,7 +15,7 @@ import os
import subprocess
import uuid
from oslo.utils import timeutils
from oslo_utils import timeutils
import saml2
from saml2 import md
from saml2 import saml

@ -15,7 +15,7 @@
import re
import jsonschema
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import config

@ -17,7 +17,7 @@ import random
import uuid
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import sql

@ -15,7 +15,7 @@
"""Extensions supporting OAuth1."""
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone.common import controller
from keystone.common import dependency

@ -12,7 +12,7 @@
import datetime
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone.common import kvs
from keystone import config

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone.common import controller
from keystone.common import dependency

@ -13,7 +13,7 @@
import abc
import datetime
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import cache

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from oslo_utils import timeutils
# The set of attributes common between the RevokeEvent

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import encodeutils
from oslo_utils import encodeutils
import six
from keystone.common import config

@ -24,6 +24,7 @@ please see pep8.py.
"""
import ast
import re
import six
@ -396,8 +397,21 @@ class CheckForLoggingIssues(BaseASTChecker):
return False
def check_oslo_namespace_imports(logical_line, blank_before, filename):
oslo_namespace_imports = re.compile(
r"(((from)|(import))\s+oslo\.utils)|"
"(from\s+oslo\s+import\s+utils)")
if re.match(oslo_namespace_imports, logical_line):
msg = ("K333: '%s' must be used instead of '%s'.") % (
logical_line.replace('oslo.', 'oslo_'),
logical_line)
yield(0, msg)
def factory(register):
register(CheckForMutableDefaultArgs)
register(block_comments_begin_with_a_space)
register(CheckForAssertingNoneEquality)
register(CheckForLoggingIssues)
register(check_oslo_namespace_imports)

@ -20,7 +20,7 @@ import os
import uuid
from oslo.config import cfg
from oslo.utils import importutils
from oslo_utils import importutils
import six
from keystone import clean

@ -13,7 +13,7 @@
"""Unified in-memory token model."""
from keystoneclient.common import cms
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import config

@ -179,6 +179,24 @@ class HackingCode(fixtures.Fixture):
]
}
oslo_namespace_imports = {
'code': """
import oslo.utils
import oslo_utils
import oslo.utils.encodeutils
import oslo_utils.encodeutils
from oslo import utils
from oslo.utils import encodeutils
from oslo_utils import encodeutils
""",
'expected_errors': [
(1, 0, 'K333'),
(3, 0, 'K333'),
(5, 0, 'K333'),
(6, 0, 'K333'),
],
}
class HackingLogging(fixtures.Fixture):

@ -17,7 +17,7 @@ import datetime
import uuid
import mock
from oslo.utils import timeutils
from oslo_utils import timeutils
from testtools import matchers
from keystone import assignment

@ -19,7 +19,7 @@ import uuid
from keystoneclient.common import cms
import mock
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from testtools import matchers

@ -14,7 +14,7 @@
import datetime
import uuid
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone import config

@ -19,7 +19,7 @@ from keystoneclient import exceptions as client_exceptions
from keystoneclient.v2_0 import client as ks_client
import mock
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_utils import timeutils
import webob
from keystone import config

@ -15,7 +15,7 @@ import datetime
import uuid
import mock
from oslo.utils import timeutils
from oslo_utils import timeutils
from testtools import matchers
from keystone.contrib import revoke

@ -14,7 +14,7 @@
import datetime
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone import config
from keystone import exception

@ -16,7 +16,7 @@ import datetime
import uuid
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from testtools import matchers

@ -20,7 +20,7 @@ import uuid
from keystoneclient.common import cms
import mock
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from testtools import matchers
from testtools import testcase

@ -13,7 +13,7 @@
import datetime
import uuid
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from testtools import matchers

@ -120,3 +120,13 @@ class TestCheckForNonDebugLoggingIssues(BaseStyleCheck):
actual_errors = [(e[0] - import_lines, e[1], e[2])
for e in actual_errors]
self.assertEqual(expected_errors or [], actual_errors)
class TestCheckOsloNamespaceImports(BaseStyleCheck):
def get_checker(self):
return checks.check_oslo_namespace_imports
def test(self):
code = self.code_ex.oslo_namespace_imports['code']
errors = self.code_ex.oslo_namespace_imports['expected_errors']
self.assert_has_errors(code, expected_errors=errors)

@ -13,7 +13,7 @@
import copy
import uuid
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone.common import config
from keystone import exception

@ -17,7 +17,7 @@ import sys
from keystoneclient.common import cms
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import controller

@ -16,7 +16,7 @@
from __future__ import absolute_import
import copy
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import kvs

@ -15,7 +15,7 @@
import copy
import functools
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone.common import sql
from keystone import config

@ -17,7 +17,7 @@
import abc
import copy
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import cache

@ -21,7 +21,7 @@ import sys
import uuid
from keystoneclient.common import cms
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone.common import cache

@ -13,7 +13,7 @@
# under the License.
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from six.moves.urllib import parse

@ -14,7 +14,7 @@
import time
from oslo.utils import timeutils
from oslo_utils import timeutils
from keystone.common import sql
from keystone import exception

@ -14,7 +14,7 @@
import uuid
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from keystone import assignment

Loading…
Cancel
Save