diff --git a/karborclient/openstack/__init__.py b/karborclient/common/apiclient/__init__.py similarity index 100% rename from karborclient/openstack/__init__.py rename to karborclient/common/apiclient/__init__.py diff --git a/karborclient/openstack/common/apiclient/auth.py b/karborclient/common/apiclient/auth.py similarity index 93% rename from karborclient/openstack/common/apiclient/auth.py rename to karborclient/common/apiclient/auth.py index 9fb63ee..8810cd8 100644 --- a/karborclient/openstack/common/apiclient/auth.py +++ b/karborclient/common/apiclient/auth.py @@ -24,7 +24,7 @@ import os import six from stevedore import extension -from karborclient.openstack.common.apiclient import exceptions +from karborclient.common.apiclient import exceptions _discovered_plugins = {} @@ -41,7 +41,7 @@ def discover_auth_systems(): def add_plugin(ext): _discovered_plugins[ext.name] = ext.plugin - ep_namespace = "karborclient.openstack.common.apiclient.auth" + ep_namespace = "karborclient.common.apiclient.auth" mgr = extension.ExtensionManager(ep_namespace) mgr.map(add_plugin) @@ -143,8 +143,7 @@ class BaseAuthPlugin(object): @classmethod def add_opts(cls, parser): - """Populate the parser with the options for this plugin. - """ + """Populate the parser with the options for this plugin.""" for opt in cls.opt_names: # use `BaseAuthPlugin.common_opt_names` since it is never # changed in child classes @@ -153,8 +152,7 @@ class BaseAuthPlugin(object): @classmethod def add_common_opts(cls, parser): - """Add options that are common for several plugins. - """ + """Add options that are common for several plugins.""" for opt in cls.common_opt_names: cls._parser_add_opt(parser, opt) @@ -191,8 +189,7 @@ class BaseAuthPlugin(object): @abc.abstractmethod def _do_authenticate(self, http_client): - """Protected method for authentication. - """ + """Protected method for authentication.""" def sufficient_options(self): """Check if all required options are present. diff --git a/karborclient/openstack/common/apiclient/base.py b/karborclient/common/apiclient/base.py similarity index 96% rename from karborclient/openstack/common/apiclient/base.py rename to karborclient/common/apiclient/base.py index 567f4d4..698e50f 100644 --- a/karborclient/openstack/common/apiclient/base.py +++ b/karborclient/common/apiclient/base.py @@ -31,8 +31,8 @@ from oslo_utils import uuidutils import six from six.moves.urllib import parse +from karborclient.common.apiclient import exceptions from karborclient.i18n import _ -from karborclient.openstack.common.apiclient import exceptions def getid(obj): @@ -462,8 +462,7 @@ class Resource(object): @property def human_id(self): - """Human-readable ID which can be used for bash completion. - """ + """Human-readable ID which can be used for bash completion.""" if self.HUMAN_ID: name = getattr(self, self.NAME_ATTR, None) if name is not None: @@ -481,7 +480,7 @@ class Resource(object): def __getattr__(self, k): if k not in self.__dict__: - #NOTE(bcwaldon): disallow lazy-loading if already loaded once + # NOTE(bcwaldon): disallow lazy-loading if already loaded once if not self.is_loaded(): self.get() return self.__getattr__(k) diff --git a/karborclient/openstack/common/apiclient/client.py b/karborclient/common/apiclient/client.py similarity index 96% rename from karborclient/openstack/common/apiclient/client.py rename to karborclient/common/apiclient/client.py index bb549cf..4a404b6 100644 --- a/karborclient/openstack/common/apiclient/client.py +++ b/karborclient/common/apiclient/client.py @@ -40,7 +40,6 @@ from karborclient.i18n import _ from karborclient.openstack.common.apiclient import exceptions - _logger = logging.getLogger(__name__) @@ -63,7 +62,7 @@ class HTTPClient(object): into terminal and send the same request with curl. """ - user_agent = "karborclient.openstack.common.apiclient" + user_agent = "karborclient.common.apiclient" def __init__(self, auth_plugin, @@ -272,7 +271,7 @@ class HTTPClient(object): >>> def test_clients(): ... from keystoneclient.auth import keystone - ... from openstack.common.apiclient import client + ... from karborclient.common.apiclient import client ... auth = keystone.KeystoneAuthPlugin( ... username="user", password="pass", tenant_name="tenant", ... auth_url="http://auth:5000/v2.0") @@ -358,8 +357,7 @@ class BaseClient(object): "Must be one of: %(version_map)s") % { 'api_name': api_name, 'version': version, - 'version_map': ', '.join(version_map.keys()) - } + 'version_map': ', '.join(version_map.keys())} raise exceptions.UnsupportedVersion(msg) return importutils.import_class(client_path) diff --git a/karborclient/openstack/common/apiclient/exceptions.py b/karborclient/common/apiclient/exceptions.py similarity index 95% rename from karborclient/openstack/common/apiclient/exceptions.py rename to karborclient/common/apiclient/exceptions.py index 25b7472..29b11c7 100644 --- a/karborclient/openstack/common/apiclient/exceptions.py +++ b/karborclient/common/apiclient/exceptions.py @@ -28,8 +28,7 @@ from karborclient.i18n import _ class ClientException(Exception): - """The base exception class for all exceptions this library raises. - """ + """The base exception class for all exceptions this library raises.""" pass @@ -107,8 +106,7 @@ class AmbiguousEndpoints(EndpointException): class HttpError(ClientException): - """The base exception class for all HTTP exceptions. - """ + """The base exception class for all HTTP exceptions.""" http_status = 0 message = _("HTTP Error") @@ -426,7 +424,7 @@ def from_response(response, method, url): """ req_id = response.headers.get("x-openstack-request-id") - #NOTE(hdd) true for older versions of nova and cinder + # NOTE(hdd) true for older versions of nova and cinder if not req_id: req_id = response.headers.get("x-compute-request-id") kwargs = { diff --git a/karborclient/openstack/common/apiclient/fake_client.py b/karborclient/common/apiclient/fake_client.py similarity index 93% rename from karborclient/openstack/common/apiclient/fake_client.py rename to karborclient/common/apiclient/fake_client.py index 3bacf42..3b55cc9 100644 --- a/karborclient/openstack/common/apiclient/fake_client.py +++ b/karborclient/common/apiclient/fake_client.py @@ -30,7 +30,7 @@ import requests import six from six.moves.urllib import parse -from karborclient.openstack.common.apiclient import client +from karborclient.common.apiclient import client def assert_has_keys(dct, required=None, optional=None): @@ -48,8 +48,7 @@ def assert_has_keys(dct, required=None, optional=None): class TestResponse(requests.Response): - """Wrap requests.Response and provide a convenient initialization. - """ + """Wrap requests.Response and provide a convenient initialization.""" def __init__(self, data): super(TestResponse, self).__init__() @@ -86,13 +85,12 @@ class FakeHTTPClient(client.HTTPClient): def __init__(self, *args, **kwargs): self.callstack = [] self.fixtures = kwargs.pop("fixtures", None) or {} - if not args and not "auth_plugin" in kwargs: + if not args and "auth_plugin" not in kwargs: args = (None, ) super(FakeHTTPClient, self).__init__(*args, **kwargs) def assert_called(self, method, url, body=None, pos=-1): - """Assert than an API method was just called. - """ + """Assert than an API method was just called.""" expected = (method, url) called = self.callstack[pos][0:2] assert self.callstack, \ @@ -107,8 +105,7 @@ class FakeHTTPClient(client.HTTPClient): (self.callstack[pos][3], body)) def assert_called_anytime(self, method, url, body=None): - """Assert than an API method was called anytime in the test. - """ + """Assert than an API method was called anytime in the test.""" expected = (method, url) assert self.callstack, \ diff --git a/karborclient/common/base.py b/karborclient/common/base.py index 011328e..3478bed 100644 --- a/karborclient/common/base.py +++ b/karborclient/common/base.py @@ -20,8 +20,9 @@ import copy import six from six.moves.urllib import parse +from karborclient.common.apiclient import exceptions from karborclient.common import http -from karborclient.openstack.common.apiclient import exceptions + SORT_DIR_VALUES = ('asc', 'desc') SORT_KEY_VALUES = ('id', 'status', 'name', 'created_at') diff --git a/karborclient/common/http.py b/karborclient/common/http.py index b222dfa..921f3b0 100644 --- a/karborclient/common/http.py +++ b/karborclient/common/http.py @@ -26,7 +26,7 @@ import requests import six from six.moves import urllib -from karborclient.openstack.common.apiclient import exceptions as exc +from karborclient.common.apiclient import exceptions as exc LOG = logging.getLogger(__name__) USER_AGENT = 'python-karborclient' diff --git a/karborclient/common/utils.py b/karborclient/common/utils.py index bd7f3e5..adfdfbb 100644 --- a/karborclient/common/utils.py +++ b/karborclient/common/utils.py @@ -23,7 +23,7 @@ from oslo_utils import importutils import prettytable -from karborclient.openstack.common.apiclient import exceptions +from karborclient.common.apiclient import exceptions # Decorator for cli-args diff --git a/karborclient/openstack/common/__init__.py b/karborclient/openstack/common/__init__.py deleted file mode 100644 index e7c6af3..0000000 --- a/karborclient/openstack/common/__init__.py +++ /dev/null @@ -1,17 +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. - -import six - - -six.add_move(six.MovedModule('mox', 'mox', 'mox3.mox')) diff --git a/karborclient/openstack/common/apiclient/__init__.py b/karborclient/openstack/common/apiclient/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/karborclient/shell.py b/karborclient/shell.py index 52680d6..0a57bec 100644 --- a/karborclient/shell.py +++ b/karborclient/shell.py @@ -33,8 +33,9 @@ import six.moves.urllib.parse as urlparse import karborclient from karborclient import client as karbor_client +from karborclient.common.apiclient import exceptions as exc from karborclient.common import utils -from karborclient.openstack.common.apiclient import exceptions as exc + logger = logging.getLogger(__name__) diff --git a/karborclient/tests/unit/test_http.py b/karborclient/tests/unit/test_http.py index 490878e..8c382c8 100644 --- a/karborclient/tests/unit/test_http.py +++ b/karborclient/tests/unit/test_http.py @@ -16,8 +16,8 @@ import socket import mock import testtools +from karborclient.common.apiclient import exceptions as exc from karborclient.common import http -from karborclient.openstack.common.apiclient import exceptions as exc from karborclient.tests.unit import fakes diff --git a/karborclient/tests/unit/test_shell.py b/karborclient/tests/unit/test_shell.py index e75290e..20d4119 100644 --- a/karborclient/tests/unit/test_shell.py +++ b/karborclient/tests/unit/test_shell.py @@ -23,7 +23,7 @@ from oslo_log import log import six from testtools import matchers -from karborclient.openstack.common.apiclient import exceptions +from karborclient.common.apiclient import exceptions import karborclient.shell from karborclient.tests.unit import base diff --git a/karborclient/v1/shell.py b/karborclient/v1/shell.py index 863b47f..0307426 100644 --- a/karborclient/v1/shell.py +++ b/karborclient/v1/shell.py @@ -11,15 +11,15 @@ # under the License. import argparse - import os -from karborclient.common import base -from karborclient.common import utils -from karborclient.openstack.common.apiclient import exceptions from oslo_serialization import jsonutils from oslo_utils import uuidutils +from karborclient.common.apiclient import exceptions +from karborclient.common import base +from karborclient.common import utils + @utils.arg('--all-tenants', dest='all_tenants', diff --git a/openstack-common.conf b/openstack-common.conf deleted file mode 100644 index 191a053..0000000 --- a/openstack-common.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] - -# The list of modules to copy from openstack-common -module=apiclient.exceptions -module=apiclient - -# The base module to hold the copy of openstack.common -base=karborclient diff --git a/tox.ini b/tox.ini index 6ec119f..d5d3c68 100644 --- a/tox.ini +++ b/tox.ini @@ -37,4 +37,4 @@ commands = oslo_debug_helper {posargs} show-source = True ignore = E123,E125 builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools