diff options
Diffstat (limited to 'glanceclient/v1/apiclient')
-rw-r--r-- | glanceclient/v1/apiclient/base.py | 12 | ||||
-rw-r--r-- | glanceclient/v1/apiclient/exceptions.py | 4 | ||||
-rw-r--r-- | glanceclient/v1/apiclient/utils.py | 6 |
3 files changed, 8 insertions, 14 deletions
diff --git a/glanceclient/v1/apiclient/base.py b/glanceclient/v1/apiclient/base.py index a12a8cc..165e6de 100644 --- a/glanceclient/v1/apiclient/base.py +++ b/glanceclient/v1/apiclient/base.py @@ -41,8 +41,7 @@ import abc import copy from oslo_utils import strutils -import six -from six.moves.urllib import parse +import urllib.parse from glanceclient._i18n import _ from glanceclient.v1.apiclient import exceptions @@ -224,8 +223,7 @@ class BaseManager(HookableMixin): return self.client.delete(url) -@six.add_metaclass(abc.ABCMeta) -class ManagerWithFind(BaseManager): +class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta): """Manager with additional `find()`/`findall()` methods.""" @abc.abstractmethod @@ -350,10 +348,11 @@ class CrudManager(BaseManager): """ kwargs = self._filter_kwargs(kwargs) + query = urllib.parse.urlencode(kwargs) if kwargs else '', return self._list( '%(base_url)s%(query)s' % { 'base_url': self.build_url(base_url=base_url, **kwargs), - 'query': '?%s' % parse.urlencode(kwargs) if kwargs else '', + 'query': '?%s' % query, }, self.collection_key) @@ -389,10 +388,11 @@ class CrudManager(BaseManager): """ kwargs = self._filter_kwargs(kwargs) + query = urllib.parse.urlencode(kwargs) if kwargs else '', rl = self._list( '%(base_url)s%(query)s' % { 'base_url': self.build_url(base_url=base_url, **kwargs), - 'query': '?%s' % parse.urlencode(kwargs) if kwargs else '', + 'query': '?%s' % query, }, self.collection_key) num = len(rl) diff --git a/glanceclient/v1/apiclient/exceptions.py b/glanceclient/v1/apiclient/exceptions.py index f3d778c..27b3eba 100644 --- a/glanceclient/v1/apiclient/exceptions.py +++ b/glanceclient/v1/apiclient/exceptions.py @@ -36,8 +36,6 @@ Exception definitions. import inspect import sys -import six - from glanceclient._i18n import _ @@ -461,7 +459,7 @@ def from_response(response, method, url): kwargs["message"] = (error.get("message") or error.get("faultstring")) kwargs["details"] = (error.get("details") or - six.text_type(body)) + str(body)) elif content_type.startswith("text/"): kwargs["details"] = getattr(response, 'text', '') diff --git a/glanceclient/v1/apiclient/utils.py b/glanceclient/v1/apiclient/utils.py index 814a37b..7d3e4e0 100644 --- a/glanceclient/v1/apiclient/utils.py +++ b/glanceclient/v1/apiclient/utils.py @@ -26,7 +26,6 @@ from oslo_utils import encodeutils from oslo_utils import uuidutils -import six from glanceclient._i18n import _ from glanceclient.v1.apiclient import exceptions @@ -52,10 +51,7 @@ def find_resource(manager, name_or_id, **find_args): # now try to get entity as uuid try: - if six.PY2: - tmp_id = encodeutils.safe_encode(name_or_id) - else: - tmp_id = encodeutils.safe_decode(name_or_id) + tmp_id = encodeutils.safe_decode(name_or_id) if uuidutils.is_uuid_like(tmp_id): return manager.get(tmp_id) |