Remove six

Because this library no longer supports Python 2, usage if six is not
needed.

Change-Id: Ib13170ad442dd486c939178f66af66c6f6f7288b
This commit is contained in:
Takashi Kajinami 2024-01-17 17:59:11 +09:00
parent 4eaaa5791b
commit e0fe706ff2
19 changed files with 71 additions and 78 deletions

View File

@ -25,7 +25,7 @@ def create_post_delete(queue_name, messages):
keystone auth strategy enabled on Zaqar server side.
:params queue_name: The name of the queue
:type queue_name: `six.text_type`
:type queue_name: str
:params messages: Messages to post.
:type messages: list
"""

View File

@ -25,7 +25,7 @@ def create_post_delete(queue_name, messages):
keystone auth strategy enabled on Zaqar server side.
:params queue_name: The name of the queue
:type queue_name: `six.text_type`
:type queue_name: str
:params messages: Messages to post.
:type messages: list
"""

View File

@ -24,7 +24,7 @@ def create_post_delete(queue_name, messages):
``signed-url`` auth strategy enabled on Zaqar server side.
:params queue_name: The name of the queue
:type queue_name: `six.text_type`
:type queue_name: str
:params messages: Messages to post.
:type messages: list
"""

View File

@ -26,7 +26,7 @@ def create_post_delete(queue_name, messages):
and finally deletes it.
:params queue_name: The name of the queue
:type queue_name: `six.text_type`
:type queue_name: str
:params messages: Messages to post.
:type messages: list
"""

View File

@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
requests>=2.14.2 # Apache-2.0
six>=1.10.0 # MIT
stevedore>=1.20.0 # Apache-2.0
jsonschema>=2.6.0 # MIT

View File

@ -30,7 +30,7 @@ def get_backend(backend='keystone', options=None):
:params backend: The backend name to load.
Default: `keystone`
:type backend: `six.string_types`
:type backend: str
:param options: Options to pass to the Auth
backend. Refer to the backend for more info.
:type options: `dict`

View File

@ -15,11 +15,8 @@
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class AuthBackend(object):
class AuthBackend(object, metaclass=abc.ABCMeta):
def __init__(self, conf):
self.conf = conf

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six.moves.urllib.parse as urlparse
import urllib.parse
from keystoneauth1 import discover
from keystoneauth1 import exceptions as ka_exc
@ -145,7 +145,7 @@ class KeystoneAuth(base.AuthBackend):
except ka_exc.ClientException:
# Identity service may not support discovery. In that case,
# try to determine version from auth_url
url_parts = urlparse.urlparse(auth_url)
url_parts = urllib.parse.urlparse(auth_url)
(scheme, netloc, path, params, query, fragment) = url_parts
path = path.lower()
if path.startswith('/v3'):

View File

@ -29,7 +29,7 @@ class Client(object):
"""Client base class
:param url: Zaqar's instance base url.
:type url: `six.text_type`
:type url: str
:param version: API Version pointing to.
:type version: `int`
:param conf: CONF object.
@ -90,7 +90,7 @@ class Client(object):
"""Returns a queue instance
:param ref: Queue's reference id.
:type ref: `six.text_type`
:type ref: str
:returns: A queue instance
:rtype: `queues.Queue`
@ -120,7 +120,7 @@ class Client(object):
gotten from `links` sections in responses like queues' lists.
:params ref: The reference path.
:type ref: `six.text_type`
:type ref: str
"""
req, trans = self._request_and_transport()
req.ref = ref
@ -132,7 +132,7 @@ class Client(object):
"""Returns a pool instance
:param ref: Pool's reference name.
:type ref: `six.text_type`
:type ref: str
:returns: A pool instance
:rtype: `pool.Pool`
@ -162,7 +162,7 @@ class Client(object):
"""Returns a flavor instance
:param ref: Flavor's reference name.
:type ref: `six.text_type`
:type ref: str
:returns: A flavor instance
:rtype: `flavor.Flavor`

View File

@ -42,7 +42,7 @@ def _common_queue_ops(operation, transport, request, name, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param name: Queue reference name.
:type name: `six.text_type`
:type name: str
:param callback: Optional callable to use as callback.
If specified, this request will be sent asynchronously.
(IGNORED UNTIL ASYNC SUPPORT IS COMPLETE)
@ -63,7 +63,7 @@ def queue_create(transport, request, name,
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param name: Queue reference name.
:type name: `six.text_type`
:type name: str
:param metadata: Queue's metadata object. (>=v1.1)
:type metadata: `dict`
:param callback: Optional callable to use as callback.
@ -88,7 +88,7 @@ def queue_update(transport, request, name, metadata, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param name: Queue reference name.
:type name: `six.text_type`
:type name: str
:param metadata: Queue's metadata object. (>=v1.1)
:type metadata: `dict`
:param callback: Optional callable to use as callback.
@ -184,7 +184,7 @@ def message_list(transport, request, queue_name, callback=None, **kwargs):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param callback: Optional callable to use as callback.
If specified, this request will be sent asynchronously.
(IGNORED UNTIL ASYNC SUPPORT IS COMPLETE)
@ -226,7 +226,7 @@ def message_post(transport, request, queue_name, messages, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param messages: One or more messages to post.
:param messages: `list`
:param callback: Optional callable to use as callback.
@ -251,9 +251,9 @@ def message_get(transport, request, queue_name, message_id, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param message_id: Message reference.
:param message_id: `six.text_type`
:param message_id: str
:param callback: Optional callable to use as callback.
If specified, this request will be sent asynchronously.
(IGNORED UNTIL ASYNC SUPPORT IS COMPLETE)
@ -276,9 +276,9 @@ def message_get_many(transport, request, queue_name, messages, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param messages: Messages references.
:param messages: list of `six.text_type`
:param messages: list of str
:param callback: Optional callable to use as callback.
If specified, this request will be sent asynchronously.
(IGNORED UNTIL ASYNC SUPPORT IS COMPLETE)
@ -302,9 +302,9 @@ def message_delete(transport, request, queue_name, message_id,
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param message_id: Message reference.
:param message_id: `six.text_type`
:param message_id: str
:param callback: Optional callable to use as callback.
If specified, this request will be sent asynchronously.
(IGNORED UNTIL ASYNC SUPPORT IS COMPLETE)
@ -329,9 +329,9 @@ def message_delete_many(transport, request, queue_name,
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param ids: Ids of the messages to delete
:type ids: List of `six.text_type`
:type ids: List of str
:param callback: Optional callable to use as callback.
If specified, this request will be sent asynchronously.
(IGNORED UNTIL ASYNC SUPPORT IS COMPLETE)
@ -353,7 +353,7 @@ def message_pop(transport, request, queue_name,
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param count: Number of messages to pop.
:type count: int
:param callback: Optional callable to use as callback.
@ -449,7 +449,7 @@ def pool_get(transport, request, pool_name, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param pool_name: Pool reference name.
:type pool_name: `six.text_type`
:type pool_name: str
"""
@ -469,7 +469,7 @@ def pool_create(transport, request, pool_name, pool_data):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param pool_name: Pool reference name.
:type pool_name: `six.text_type`
:type pool_name: str
:param pool_data: Pool's properties, i.e: weight, uri, options.
:type pool_data: `dict`
"""
@ -488,7 +488,7 @@ def pool_update(transport, request, pool_name, pool_data):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param pool_name: Pool reference name.
:type pool_name: `six.text_type`
:type pool_name: str
:param pool_data: Pool's properties, i.e: weight, uri, options.
:type pool_data: `dict`
"""
@ -532,7 +532,7 @@ def pool_delete(transport, request, pool_name):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param pool_name: Pool reference name.
:type pool_name: `six.text_type`
:type pool_name: str
"""
request.operation = 'pool_delete'
@ -548,7 +548,7 @@ def flavor_create(transport, request, name, flavor_data):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param name: Flavor reference name.
:type name: `six.text_type`
:type name: str
:param flavor_data: Flavor's properties, i.e: pool, capabilities.
:type flavor_data: `dict`
"""
@ -567,7 +567,7 @@ def flavor_get(transport, request, flavor_name, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param flavor_name: Flavor reference name.
:type flavor_name: `six.text_type`
:type flavor_name: str
"""
@ -586,7 +586,7 @@ def flavor_update(transport, request, flavor_name, flavor_data):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param flavor_name: Flavor reference name.
:type flavor_name: `six.text_type`
:type flavor_name: str
:param flavor_data: Flavor's properties, i.e: pool, capabilities.
:type flavor_data: `dict`
"""
@ -630,7 +630,7 @@ def flavor_delete(transport, request, name):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param name: Flavor reference name.
:type name: `six.text_type`
:type name: str
"""
request.operation = 'flavor_delete'

View File

@ -38,9 +38,9 @@ class Queue(object):
:param client: The client object of Zaqar.
:type client: `object`
:param name: Name of the queue.
:type name: `six.string_type`
:type name: str
:param href : Hypertext Reference.
:type href: `six.string_type`
:type href: str
:param metadata : A metadata object of the queue.
:type metadata: `dict`
:param auto_create: If create the queue automatically in database.
@ -173,7 +173,7 @@ class Queue(object):
"""Gets a message by id
:param message_id: Message's reference
:type message_id: `six.text_type`
:type message_id: str
:returns: A message
:rtype: `dict`
@ -195,7 +195,7 @@ class Queue(object):
and the former has the priority.
:param messages: List of messages' ids to retrieve.
:type messages: *args of `six.string_type`
:type messages: *args of str
:param params: Filters to use for getting messages
:type params: **kwargs dict.
@ -229,7 +229,7 @@ class Queue(object):
"""Deletes a set of messages from the server
:param messages: List of messages' ids to delete.
:type messages: *args of `six.string_type`
:type messages: *args of str
"""
req, trans = self.client._request_and_transport()

View File

@ -26,7 +26,7 @@ class Client(client.Client):
"""Client base class
:param url: Zaqar's instance base url.
:type url: `six.text_type`
:type url: str
:param version: API Version pointing to.
:type version: `int`
:param conf: CONF object.
@ -49,7 +49,7 @@ class Client(client.Client):
"""Returns a queue instance
:param ref: Queue's reference id.
:type ref: `six.text_type`
:type ref: str
:returns: A queue instance
:rtype: `queues.Queue`
@ -79,7 +79,7 @@ class Client(client.Client):
"""Returns a subscription instance
:param queue_name: Name of the queue to subscribe to.
:type queue_name: `six.text_type`
:type queue_name: str
:returns: A subscription instance
:rtype: `subscription.Subscription`

View File

@ -71,7 +71,7 @@ def queue_update(transport, request, name, metadata, callback=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param name: Queue reference name.
:type name: `six.text_type`
:type name: str
:param metadata: Queue's metadata object.
:type metadata: `list`
:param callback: Optional callable to use as callback.
@ -96,7 +96,7 @@ def queue_purge(transport, request, name, resource_types=None):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param name: Queue reference name.
:type name: `six.text_type`
:type name: str
:param resource_types: Resource types will be purged
:type resource_types: `list`
"""
@ -118,13 +118,13 @@ def signed_url_create(transport, request, queue_name, paths=None,
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: name of Queue for the URL to access
:type name: `six.text_type`
:type name: str
:param paths: Allowed actions. Options: messages, subscriptions, claims
:type name: list
:param ttl_seconds: Seconds the URL will be valid for, default 86400
:type name: int
:param project_id: defaults to None
:type name: `six.text_type`
:type name: str
:param methods: HTTP methods to allow, defaults to ["GET"]
:type name: `list`
"""
@ -161,7 +161,7 @@ def subscription_create(transport, request, queue_name, subscription_data):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param subscription_data: Subscription's properties, i.e: subscriber,
ttl, options.
:type subscription_data: `dict`
@ -183,9 +183,9 @@ def subscription_get(transport, request, queue_name, subscription_id):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param subscription_id: ID of subscription.
:type subscription_id: `six.text_type`
:type subscription_id: str
"""
@ -206,9 +206,9 @@ def subscription_update(transport, request, queue_name, subscription_id,
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param subscription_id: ID of subscription.
:type subscription_id: `six.text_type`
:type subscription_id: str
:param subscription_data: Subscription's properties, i.e: subscriber,
ttl, options.
:type subscription_data: `dict`
@ -231,9 +231,9 @@ def subscription_delete(transport, request, queue_name, subscription_id):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param subscription_id: ID of subscription.
:type subscription_id: `six.text_type`
:type subscription_id: str
"""
request.operation = 'subscription_delete'
@ -250,7 +250,7 @@ def subscription_list(transport, request, queue_name, **kwargs):
:param request: Request instance ready to be sent.
:type request: `transport.request.Request`
:param queue_name: Queue reference name.
:type queue_name: `six.text_type`
:type queue_name: str
:param kwargs: Optional arguments for this operation.
- marker: Where to start getting subscriptions from.
- limit: Maximum number of subscriptions to get.

View File

@ -14,10 +14,10 @@
# limitations under the License.
import os
import urllib.parse
import fixtures
import openstack.config
from six.moves import urllib_parse
import testtools
_USE_AUTHENTICATION = os.environ.get('ZAQARCLIENT_AUTH_FUNCTIONAL', False)
@ -75,10 +75,10 @@ class TestBase(testtools.TestCase):
def _setup_auth_params(self):
self.creds = self._credentials().get_auth_args()
parsed_url = urllib_parse.urlparse(self.creds['auth_url'])
parsed_url = urllib.parse.urlparse(self.creds['auth_url'])
auth_url = self.creds['auth_url']
if not parsed_url.path or parsed_url.path == '/':
auth_url = urllib_parse.urljoin(self.creds['auth_url'], 'v3')
auth_url = urllib.parse.urljoin(self.creds['auth_url'], 'v3')
if parsed_url.path == '/identity':
auth_url = '%s/v3' % auth_url

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six
from six.moves.urllib import parse
import urllib.parse
from stevedore import driver
from zaqarclient import errors as _errors
@ -25,7 +25,7 @@ def get_transport(transport='http', version=1, options=None):
:param transport: Transport name.
Default: http
:type transport: `six.string_types`
:type transport: str
:param version: Version of the target transport.
Default: 1
:type version: int
@ -56,7 +56,7 @@ def get_transport_for(url_or_request, version=1, options=None):
zmq://example.org:8888/v1/
:param url_or_request: a transport URL
:type url_or_request: `six.string_types` or
:type url_or_request: str or
`zaqarclient.transport.request.Request`
:param version: Version of the target transport.
:type version: int
@ -66,8 +66,8 @@ def get_transport_for(url_or_request, version=1, options=None):
"""
url = url_or_request
if not isinstance(url_or_request, six.string_types):
if not isinstance(url_or_request, str):
url = url_or_request.endpoint
parsed = parse.urlparse(url)
parsed = urllib.parse.urlparse(url)
return get_transport(parsed.scheme, version, options)

View File

@ -29,7 +29,7 @@ class Api(object):
"""Returns `True` if `operation` is supported
:param operation: The operation to check on.
:type operation: `six.text_type`
:type operation: str
:rtype: bool
"""
@ -40,7 +40,7 @@ class Api(object):
:param operation: Operation for which params need
to be validated.
:type operation: `six.text_type`
:type operation: str
:returns: Operation's schema
:rtype: dict
@ -65,7 +65,7 @@ class Api(object):
:param operation: Operation's for which params need
to be validated.
:type operation: `six.text_type`
:type operation: str
:param params: Params to validate
:type params: dict

View File

@ -15,13 +15,10 @@
import abc
import six
from zaqarclient.transport import errors
@six.add_metaclass(abc.ABCMeta)
class Transport(object):
class Transport(object, metaclass=abc.ABCMeta):
# common HTTP codes used by multiple transports
http_to_zaqar = {

View File

@ -86,11 +86,11 @@ class Request(object):
:param headers: Request headers. Default: None
:type headers: dict
:param api: Api entry point. i.e: 'queues.v1'
:type api: `six.text_type`.
:type api: str.
:param verify: If verify the SSL cert
:type verify: bool
:param cert: certificate of SSL
:type cert: `six.text_type`
:type cert: str
:param session: Keystone session
:type session: keystone session object
"""

View File

@ -26,7 +26,7 @@ class Response(object):
:param request: The request sent to the server.
:type: `zaqarclient.transport.request.Request`
:param content: Response's content
:type: `six.string_types`
:type: str
:param headers: Optional headers returned in the response.
:type: dict
:param status_code: Optional status_code returned in the response.