[Part1] Remove six

We don't need this in a Python 3-only world.
Remove six in follows:
1. zaqar/common/transport/wsgi/helpers.py
2. zaqar/common/urls.py
3. zaqar/common/utils.py
4. zaqar/notification/notifier.py
5. zaqar/notification/tasks/mailto.py

Change-Id: Iae6d4f415b215b9fdf675a0fcf00282fc98d58b7
This commit is contained in:
melissaml 2020-10-14 17:37:17 +08:00 committed by wanghao
parent 20fabeb0b5
commit 772db810a0
7 changed files with 9 additions and 18 deletions

View File

@ -51,7 +51,6 @@ requests==2.14.2
requestsexceptions==1.2.0
restructuredtext-lint==1.1.1
rfc3986==0.3.1
six==1.10.0
SQLAlchemy==1.3.19
sqlalchemy-migrate==0.11.0
stestr==2.0.0

View File

@ -15,7 +15,6 @@ python-memcached>=1.56 # PSF
python-swiftclient>=3.2.0 # Apache-2.0
WebOb>=1.7.1 # MIT
stevedore>=1.20.0 # Apache-2.0
six>=1.10.0 # MIT
oslo.cache>=1.26.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
oslo.context>=2.19.2 # Apache-2.0

View File

@ -21,7 +21,6 @@ import uuid
import falcon
from oslo_log import log as logging
import six
from zaqar.common import urls
from zaqar import context
@ -131,7 +130,7 @@ def require_client_id(validate, req, resp, params):
description = _(u'Malformed hexadecimal UUID.')
raise falcon.HTTPBadRequest('Wrong UUID value', description)
except validation.ValidationFailed as ex:
raise falcon.HTTPBadRequest(six.text_type(ex))
raise falcon.HTTPBadRequest(str(ex))
else:
# NOTE(wanghao): Since we changed the get_client_uuid to support
# other format of client id, so need to check the uuid here for
@ -174,8 +173,6 @@ def validate_queue_identification(validate, req, resp, params):
except validation.ValidationFailed:
project = params['project_id']
queue = params['queue_name']
if six.PY2:
queue = queue.decode('utf-8', 'replace')
LOG.debug(u'Invalid queue name "%(queue)s" submitted for '
u'project: %(project)s',
@ -308,8 +305,6 @@ def validate_topic_identification(validate, req, resp, params):
except validation.ValidationFailed:
project = params['project_id']
queue = params['topic_name']
if six.PY2:
queue = queue.decode('utf-8', 'replace')
LOG.debug(u'Invalid topic name "%(topic)s" submitted for '
u'project: %(project)s',

View File

@ -18,7 +18,6 @@ import hashlib
import hmac
from oslo_utils import timeutils
import six
_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S'
@ -78,12 +77,13 @@ def create_signed_url(key, paths, project=None, expires=None, methods=None):
methods = sorted(methods)
paths = sorted(paths)
expires_str = expires.strftime(_DATE_FORMAT)
hmac_body = six.b(r'%(paths)s\n%(methods)s\n%(project)s\n%(expires)s' %
{'paths': ','.join(paths), 'methods': ','.join(methods),
'project': project, 'expires': expires_str})
hmac_body = (r'%(paths)s\n%(methods)s\n%(project)s\n%(expires)s' %
{'paths': ','.join(paths), 'methods': ','.join(methods),
'project': project, 'expires':
expires_str}).encode('utf-8')
if not isinstance(key, six.binary_type):
key = six.binary_type(key.encode('utf-8'))
if not isinstance(key, bytes):
key = bytes(key.encode('utf-8'))
return {'paths': paths,
'methods': methods,

View File

@ -16,7 +16,6 @@
"""utils: general-purpose utilities."""
from oslo_config import cfg
import six
def fields(d, names, pred=lambda x: True,
@ -41,7 +40,6 @@ def fields(d, names, pred=lambda x: True,
_pytype_to_cfgtype = {
six.text_type: cfg.StrOpt,
str: cfg.StrOpt,
int: cfg.IntOpt,
bool: cfg.BoolOpt,

View File

@ -18,7 +18,7 @@ from stevedore import driver
import futurist
from oslo_log import log as logging
from six.moves import urllib_parse
from urllib import parse as urllib_parse
from zaqar.common import auth
from zaqar.common import urls

View File

@ -15,9 +15,9 @@
from email.mime import text
import json
from six.moves import urllib_parse
import smtplib
import subprocess
from urllib import parse as urllib_parse
from oslo_log import log as logging