diff --git a/.coveragerc b/.coveragerc index 1f2fb4ed..4b0776ca 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,7 +3,6 @@ source = muranoclient omit = .tox/* muranoclient/tests/* - muranoclient/openstack/* [report] -ignore_errors = True \ No newline at end of file +ignore_errors = True diff --git a/muranoclient/openstack/__init__.py b/muranoclient/apiclient/__init__.py similarity index 100% rename from muranoclient/openstack/__init__.py rename to muranoclient/apiclient/__init__.py diff --git a/muranoclient/openstack/common/apiclient/auth.py b/muranoclient/apiclient/auth.py similarity index 96% rename from muranoclient/openstack/common/apiclient/auth.py rename to muranoclient/apiclient/auth.py index 42cc0f01..63933729 100644 --- a/muranoclient/openstack/common/apiclient/auth.py +++ b/muranoclient/apiclient/auth.py @@ -24,7 +24,7 @@ import os import six from stevedore import extension -from muranoclient.openstack.common.apiclient import exceptions +from muranoclient.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 = "muranoclient.openstack.common.apiclient.auth" + ep_namespace = "muranoclient.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/muranoclient/openstack/common/apiclient/base.py b/muranoclient/apiclient/base.py similarity index 99% rename from muranoclient/openstack/common/apiclient/base.py rename to muranoclient/apiclient/base.py index 0dfbce65..5ed50190 100644 --- a/muranoclient/openstack/common/apiclient/base.py +++ b/muranoclient/apiclient/base.py @@ -31,8 +31,8 @@ from oslo_utils import uuidutils import six from six.moves.urllib import parse +from muranoclient.apiclient import exceptions from muranoclient.i18n import _ -from muranoclient.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/muranoclient/openstack/common/apiclient/client.py b/muranoclient/apiclient/client.py similarity index 98% rename from muranoclient/openstack/common/apiclient/client.py rename to muranoclient/apiclient/client.py index eceaafb6..00f19299 100644 --- a/muranoclient/openstack/common/apiclient/client.py +++ b/muranoclient/apiclient/client.py @@ -36,9 +36,8 @@ from oslo_log import log as logging from oslo_utils import importutils import requests +from muranoclient.apiclient import exceptions from muranoclient.i18n import _ -from muranoclient.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 = "muranoclient.openstack.common.apiclient" + user_agent = "muranoclient.apiclient" def __init__(self, auth_plugin, @@ -354,8 +353,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/muranoclient/openstack/common/apiclient/exceptions.py b/muranoclient/apiclient/exceptions.py similarity index 98% rename from muranoclient/openstack/common/apiclient/exceptions.py rename to muranoclient/apiclient/exceptions.py index c3c27cdc..4c3483dc 100644 --- a/muranoclient/openstack/common/apiclient/exceptions.py +++ b/muranoclient/apiclient/exceptions.py @@ -28,8 +28,7 @@ from muranoclient.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, url, method): """ 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/muranoclient/openstack/common/apiclient/fake_client.py b/muranoclient/apiclient/fake_client.py similarity index 96% rename from muranoclient/openstack/common/apiclient/fake_client.py rename to muranoclient/apiclient/fake_client.py index 2eda4458..c50914ea 100644 --- a/muranoclient/openstack/common/apiclient/fake_client.py +++ b/muranoclient/apiclient/fake_client.py @@ -30,7 +30,7 @@ import requests import six from six.moves.urllib import parse -from muranoclient.openstack.common.apiclient import client +from muranoclient.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, url, method, body=None, pos=-1): - """Assert than an API method was just called. - """ + """Assert than an API method was just called.""" expected = (url, method) 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, url, method, 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 = (url, method) assert self.callstack, \ diff --git a/muranoclient/common/base.py b/muranoclient/common/base.py index 01e18cbf..97153c62 100644 --- a/muranoclient/common/base.py +++ b/muranoclient/common/base.py @@ -22,7 +22,7 @@ import copy import six -from muranoclient.openstack.common.apiclient import exceptions +from muranoclient.apiclient import exceptions # Python 2.4 compat diff --git a/muranoclient/openstack/common/__init__.py b/muranoclient/openstack/common/__init__.py deleted file mode 100644 index d1223eaf..00000000 --- a/muranoclient/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/muranoclient/openstack/common/apiclient/__init__.py b/muranoclient/openstack/common/apiclient/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/muranoclient/osc/plugin.py b/muranoclient/osc/plugin.py index 0a692045..31021ffe 100644 --- a/muranoclient/osc/plugin.py +++ b/muranoclient/osc/plugin.py @@ -15,9 +15,9 @@ from osc_lib import utils from oslo_log import log as logging +from muranoclient.apiclient import exceptions as exc from muranoclient.glance import client as art_client from muranoclient.i18n import _ -from muranoclient.openstack.common.apiclient import exceptions as exc LOG = logging.getLogger(__name__) diff --git a/muranoclient/osc/v1/action.py b/muranoclient/osc/v1/action.py index 8d5dee08..84441129 100644 --- a/muranoclient/osc/v1/action.py +++ b/muranoclient/osc/v1/action.py @@ -14,10 +14,11 @@ import json -from muranoclient.openstack.common.apiclient import exceptions from osc_lib.command import command from oslo_log import log as logging +from muranoclient.apiclient import exceptions + LOG = logging.getLogger(__name__) diff --git a/muranoclient/osc/v1/category.py b/muranoclient/osc/v1/category.py index ba198b47..5d6d83ba 100644 --- a/muranoclient/osc/v1/category.py +++ b/muranoclient/osc/v1/category.py @@ -14,11 +14,12 @@ import textwrap -from muranoclient.openstack.common.apiclient import exceptions from osc_lib.command import command from osc_lib import utils from oslo_log import log as logging +from muranoclient.apiclient import exceptions + LOG = logging.getLogger(__name__) diff --git a/muranoclient/osc/v1/environment.py b/muranoclient/osc/v1/environment.py index 2273acff..10d9c685 100644 --- a/muranoclient/osc/v1/environment.py +++ b/muranoclient/osc/v1/environment.py @@ -18,14 +18,15 @@ import sys import uuid import jsonpatch - -from muranoclient.common import utils as murano_utils -from muranoclient.openstack.common.apiclient import exceptions from osc_lib.command import command from osc_lib import utils from oslo_log import log as logging from oslo_serialization import jsonutils +from muranoclient.apiclient import exceptions +from muranoclient.common import utils as murano_utils + + LOG = logging.getLogger(__name__) diff --git a/muranoclient/osc/v1/package.py b/muranoclient/osc/v1/package.py index 7a136ac0..1a0ce088 100644 --- a/muranoclient/osc/v1/package.py +++ b/muranoclient/osc/v1/package.py @@ -18,14 +18,16 @@ import shutil import tempfile import zipfile -from muranoclient.openstack.common.apiclient import exceptions -from muranoclient.v1.package_creator import hot_package -from muranoclient.v1.package_creator import mpl_package from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib import utils from oslo_log import log as logging +from muranoclient.apiclient import exceptions +from muranoclient.v1.package_creator import hot_package +from muranoclient.v1.package_creator import mpl_package + + LOG = logging.getLogger(__name__) diff --git a/muranoclient/shell.py b/muranoclient/shell.py index a1d25d97..3329b5a6 100644 --- a/muranoclient/shell.py +++ b/muranoclient/shell.py @@ -35,10 +35,11 @@ import six import six.moves.urllib.parse as urlparse import muranoclient +from muranoclient.apiclient import exceptions as exc from muranoclient import client as murano_client from muranoclient.common import utils from muranoclient.glance import client as art_client -from muranoclient.openstack.common.apiclient import exceptions as exc + logger = logging.getLogger(__name__) diff --git a/muranoclient/tests/unit/test_package_creator.py b/muranoclient/tests/unit/test_package_creator.py index 52271357..b46744b6 100644 --- a/muranoclient/tests/unit/test_package_creator.py +++ b/muranoclient/tests/unit/test_package_creator.py @@ -15,7 +15,7 @@ import os import shutil -from muranoclient.openstack.common.apiclient import exceptions +from muranoclient.apiclient import exceptions from muranoclient.tests.unit import base from muranoclient.v1.package_creator import hot_package from muranoclient.v1.package_creator import mpl_package diff --git a/muranoclient/tests/unit/test_shell.py b/muranoclient/tests/unit/test_shell.py index 0f36061d..e0a4375a 100644 --- a/muranoclient/tests/unit/test_shell.py +++ b/muranoclient/tests/unit/test_shell.py @@ -33,9 +33,9 @@ import requests_mock import six from testtools import matchers +from muranoclient.apiclient import exceptions from muranoclient.common import exceptions as common_exceptions from muranoclient.common import utils -from muranoclient.openstack.common.apiclient import exceptions import muranoclient.shell from muranoclient.tests.unit import base from muranoclient.tests.unit import test_utils diff --git a/muranoclient/v1/package_creator/hot_package.py b/muranoclient/v1/package_creator/hot_package.py index bb9a98f1..7b54f652 100644 --- a/muranoclient/v1/package_creator/hot_package.py +++ b/muranoclient/v1/package_creator/hot_package.py @@ -19,7 +19,7 @@ import tempfile import yaml import muranoclient -from muranoclient.openstack.common.apiclient import exceptions +from muranoclient.apiclient import exceptions def generate_manifest(args): diff --git a/muranoclient/v1/package_creator/mpl_package.py b/muranoclient/v1/package_creator/mpl_package.py index c64338b1..a67f83a0 100644 --- a/muranoclient/v1/package_creator/mpl_package.py +++ b/muranoclient/v1/package_creator/mpl_package.py @@ -19,8 +19,8 @@ import tempfile import yaml import muranoclient +from muranoclient.apiclient import exceptions from muranoclient.common import utils -from muranoclient.openstack.common.apiclient import exceptions def prepare_package(args): diff --git a/muranoclient/v1/shell.py b/muranoclient/v1/shell.py index 30d2a3ad..9c85ebeb 100644 --- a/muranoclient/v1/shell.py +++ b/muranoclient/v1/shell.py @@ -28,9 +28,9 @@ from oslo_utils import strutils import six import six.moves +from muranoclient.apiclient import exceptions from muranoclient.common import exceptions as common_exceptions from muranoclient.common import utils -from muranoclient.openstack.common.apiclient import exceptions from muranoclient.v1.package_creator import hot_package from muranoclient.v1.package_creator import mpl_package diff --git a/tox.ini b/tox.ini index 75c14400..febc1ebb 100644 --- a/tox.ini +++ b/tox.ini @@ -46,4 +46,4 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen [flake8] show-source = true builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools