[Part 10] Remove all usage of six library

We don't need this in a Python 3-only world.

Remove six in follows:
1. lower-constraints.txt
2. requirements.txt
3. zaqar/bench/observer.py
4. zaqar/common/api/api.py
5. zaqar/common/api/request.py
6. zaqar/common/api/response.py
7. zaqar/common/pipeline.py
8. zaqar/common/storage/select.py

Change-Id: I8669061e00fd929c24e62ce9fd4ba31aab63e0d4
This commit is contained in:
melissaml 2020-10-15 17:35:33 +08:00 committed by wanghao
parent 1726ac41b5
commit 963ef01c6f
6 changed files with 8 additions and 9 deletions

View File

@ -21,7 +21,7 @@ from gevent import monkey as curious_george
curious_george.patch_all(thread=False, select=False) curious_george.patch_all(thread=False, select=False)
import gevent import gevent
import marktime import marktime
from six.moves import urllib import urllib
from zaqarclient.transport import errors from zaqarclient.transport import errors
from zaqar.bench import config from zaqar.bench import config

View File

@ -33,7 +33,7 @@ class Api(object):
:param action: Action for which params need :param action: Action for which params need
to be validated. to be validated.
:type action: `six.text_type` :type action: `str`
:returns: Action's schema :returns: Action's schema
:rtype: dict :rtype: dict
@ -57,7 +57,7 @@ class Api(object):
:param action: Action's for which body need :param action: Action's for which body need
to be validated. to be validated.
:type action: `six.text_type` :type action: `str`
:param body: Params to validate :param body: Params to validate
:type body: dict :type body: dict

View File

@ -28,7 +28,7 @@ class Request(object):
:param headers: Request headers. Default: None :param headers: Request headers. Default: None
:type headers: dict :type headers: dict
:param api: Api entry point. i.e: 'queues.v1' :param api: Api entry point. i.e: 'queues.v1'
:type api: `six.text_type`. :type api: `str`.
:param env: Request environment. Default: None :param env: Request environment. Default: None
:type env: dict :type env: dict
""" """

View File

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

View File

@ -32,7 +32,6 @@ them do, an AttributeError exception will be raised.
import contextlib import contextlib
from oslo_log import log as logging from oslo_log import log as logging
import six
from zaqar.common import decorators from zaqar.common import decorators
from zaqar.i18n import _ from zaqar.i18n import _
@ -58,7 +57,7 @@ class Pipeline(object):
for `method`. for `method`.
:params method: The method name to call on each stage :params method: The method name to call on each stage
:type method: `six.text_type` :type method: `str`
:returns: A callable to consume the pipeline. :returns: A callable to consume the pipeline.
""" """
@ -88,7 +87,7 @@ class Pipeline(object):
try: try:
target = getattr(stage, method) target = getattr(stage, method)
except AttributeError: except AttributeError:
sstage = six.text_type(stage) sstage = str(stage)
msgtmpl = _(u"Stage %(stage)s does not " msgtmpl = _(u"Stage %(stage)s does not "
"implement %(method)s") "implement %(method)s")
LOG.debug(msgtmpl, {'stage': sstage, 'method': method}) LOG.debug(msgtmpl, {'stage': sstage, 'method': method})

View File

@ -25,7 +25,7 @@ def weighted(objs, key='weight', generator=random.randint):
:param objs: a list of objects containing at least the field `key` :param objs: a list of objects containing at least the field `key`
:type objs: [dict] :type objs: [dict]
:param key: the field in each obj that corresponds to weight :param key: the field in each obj that corresponds to weight
:type key: six.text_type :type key: str
:param generator: a number generator taking two ints :param generator: a number generator taking two ints
:type generator: function(int, int) -> int :type generator: function(int, int) -> int
:return: an object :return: an object