diff options
-rw-r--r-- | cinderclient/client.py | 7 | ||||
-rw-r--r-- | cinderclient/shell.py | 7 | ||||
-rw-r--r-- | cinderclient/shell_utils.py | 2 | ||||
-rw-r--r-- | cinderclient/tests/unit/fakes.py | 2 | ||||
-rw-r--r-- | cinderclient/tests/unit/v2/test_limits.py | 4 | ||||
-rw-r--r-- | cinderclient/utils.py | 21 | ||||
-rw-r--r-- | cinderclient/v2/shell.py | 2 | ||||
-rw-r--r-- | cinderclient/v3/shell.py | 2 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | test-requirements.txt | 2 | ||||
-rw-r--r-- | tools/install_venv_common.py | 2 |
11 files changed, 24 insertions, 28 deletions
diff --git a/cinderclient/client.py b/cinderclient/client.py index 6193e95..b013c1e 100644 --- a/cinderclient/client.py +++ b/cinderclient/client.py @@ -16,8 +16,6 @@ # under the License. """OpenStack Client interface. Handles the REST calls and responses.""" -from __future__ import print_function - import glob import hashlib import imp @@ -35,7 +33,10 @@ from keystoneauth1.identity import base from oslo_utils import encodeutils from oslo_utils import importutils from oslo_utils import strutils -osprofiler_web = importutils.try_import("osprofiler.web") # noqa +try: + osprofiler_web = importutils.try_import("osprofiler.web") +except Exception: + pass import requests from six.moves import urllib import six.moves.urllib.parse as urlparse diff --git a/cinderclient/shell.py b/cinderclient/shell.py index acbccda..09a55b8 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -17,8 +17,6 @@ Command-line interface to the OpenStack Cinder API. """ -from __future__ import print_function - import argparse import collections import getpass @@ -33,7 +31,10 @@ from keystoneauth1 import loading from keystoneauth1 import session from oslo_utils import encodeutils from oslo_utils import importutils -osprofiler_profiler = importutils.try_import("osprofiler.profiler") # noqa +try: + osprofiler_profiler = importutils.try_import("osprofiler.profiler") +except Exception: + pass import requests import six import six.moves.urllib.parse as urlparse diff --git a/cinderclient/shell_utils.py b/cinderclient/shell_utils.py index 411dd17..b5db281 100644 --- a/cinderclient/shell_utils.py +++ b/cinderclient/shell_utils.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - import sys import time diff --git a/cinderclient/tests/unit/fakes.py b/cinderclient/tests/unit/fakes.py index 61d1904..018a75d 100644 --- a/cinderclient/tests/unit/fakes.py +++ b/cinderclient/tests/unit/fakes.py @@ -19,8 +19,6 @@ wrong the tests might raise AssertionError. I've indicated in comments the places where actual behavior differs from the spec. """ -from __future__ import print_function - def assert_has_keys(dict, required=None, optional=None): required = required or [] diff --git a/cinderclient/tests/unit/v2/test_limits.py b/cinderclient/tests/unit/v2/test_limits.py index 34ed1d2..d8fbdfe 100644 --- a/cinderclient/tests/unit/v2/test_limits.py +++ b/cinderclient/tests/unit/v2/test_limits.py @@ -177,5 +177,5 @@ class TestLimitsManager(utils.TestCase): api.client.get.assert_called_once_with('/limits%s' % query_str) self.assertIsInstance(lim, limits.Limits) - for l in lim.absolute: - self.assertEqual(l1, l) + for limit in lim.absolute: + self.assertEqual(l1, limit) diff --git a/cinderclient/utils.py b/cinderclient/utils.py index 28c458d..3b00967 100644 --- a/cinderclient/utils.py +++ b/cinderclient/utils.py @@ -12,18 +12,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -from __future__ import print_function import collections import os -import pkg_resources import sys import uuid import prettytable import six from six.moves.urllib import parse +import stevedore from cinderclient import exceptions from oslo_utils import encodeutils @@ -199,7 +197,7 @@ def unicode_key_value_to_string(src): _encode(unicode_key_value_to_string(v))) for k, v in src.items()) if isinstance(src, list): - return [unicode_key_value_to_string(l) for l in src] + return [unicode_key_value_to_string(item) for item in src] return _encode(src) @@ -332,11 +330,16 @@ def safe_issubclass(*args): def _load_entry_point(ep_name, name=None): """Try to load the entry point ep_name that matches name.""" - for ep in pkg_resources.iter_entry_points(ep_name, name=name): - try: - return ep.load() - except (ImportError, pkg_resources.UnknownExtra, AttributeError): - continue + mgr = stevedore.NamedExtensionManager( + namespace=ep_name, + names=[name], + # Ignore errors on load + on_load_failure_callback=lambda mgr, entry_point, error: None, + ) + try: + return mgr[name].plugin + except KeyError: + pass def get_function_name(func): diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index b83175e..d41e014 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import argparse import collections import copy diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index b3f69b0..1ccf02e 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import argparse import collections import os diff --git a/requirements.txt b/requirements.txt index fef5e1e..f6567f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ six>=1.10.0 # MIT oslo.i18n>=3.15.3 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 requests!=2.20.0,>=2.14.2 # Apache-2.0 +stevedore>=1.20.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index fdc3d25..065e127 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,7 @@ # process, which may cause wedges in the gate later. # Hacking already pins down pep8, pyflakes and flake8 -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=3.1.0,<3.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT fixtures>=3.0.0 # Apache-2.0/BSD diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py index 3b7ac10..0322c18 100644 --- a/tools/install_venv_common.py +++ b/tools/install_venv_common.py @@ -22,8 +22,6 @@ environment, it should be kept strictly compatible with Python 2.6. Synced in from openstack-common """ -from __future__ import print_function - import optparse import os import subprocess |