Remove all usage of six library
Convert all code to not require six library and instead use python 3.x logic. Change-Id: I3aba1299172eda0d4212177ccb794ab20dc41334
This commit is contained in:
parent
942c75ef02
commit
ad501acc9b
@ -105,7 +105,6 @@ rsa==3.4.2
|
||||
setproctitle==1.1.10
|
||||
setuptools==21.0.0
|
||||
simplegeneric==0.8.1
|
||||
six==1.10.0
|
||||
SQLAlchemy==1.0.10
|
||||
sqlalchemy-migrate==0.11.0
|
||||
sqlparse==0.2.4
|
||||
|
@ -14,7 +14,6 @@
|
||||
import json
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from wsme import types as wtypes
|
||||
|
||||
from qinling import exceptions as exc
|
||||
@ -33,7 +32,7 @@ class ListType(wtypes.UserType):
|
||||
:param value: A comma separated string of values
|
||||
:returns: A list of values.
|
||||
"""
|
||||
items = [v.strip().lower() for v in six.text_type(value).split(',')]
|
||||
items = [v.strip().lower() for v in str(value).split(',')]
|
||||
|
||||
# remove empty items.
|
||||
return [x for x in items if x]
|
||||
|
@ -21,7 +21,6 @@ from alembic import config as alembic_cfg
|
||||
from alembic import util as alembic_u
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
# We need to import qinling.api.app to
|
||||
# make sure we register all needed options.
|
||||
@ -34,7 +33,7 @@ def do_alembic_command(config, cmd, *args, **kwargs):
|
||||
try:
|
||||
getattr(alembic_cmd, cmd)(config, *args, **kwargs)
|
||||
except alembic_u.CommandError as e:
|
||||
alembic_u.err(six.text_type(e))
|
||||
alembic_u.err(str(e))
|
||||
|
||||
|
||||
def do_check_migration(config, _cmd):
|
||||
|
@ -15,7 +15,6 @@ import time
|
||||
|
||||
from oslo_log import log as logging
|
||||
import requests
|
||||
import six
|
||||
import tenacity
|
||||
|
||||
from qinling import context
|
||||
@ -48,7 +47,7 @@ def url_request(request_session, url, body=None):
|
||||
)
|
||||
return False, {'output': 'Function execution failed.'}
|
||||
|
||||
for a in six.moves.xrange(10):
|
||||
for a in range(10):
|
||||
res = None
|
||||
try:
|
||||
# Default execution max duration is 3min, could be configurable
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
from stevedore import driver
|
||||
|
||||
from qinling import exceptions as exc
|
||||
@ -22,8 +21,7 @@ from qinling import exceptions as exc
|
||||
ORCHESTRATOR = None
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class OrchestratorBase(object):
|
||||
class OrchestratorBase(object, metaclass=abc.ABCMeta):
|
||||
"""OrchestratorBase interface."""
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
from stevedore import driver
|
||||
|
||||
from qinling import exceptions as exc
|
||||
@ -22,8 +21,7 @@ from qinling import exceptions as exc
|
||||
STORAGE_PROVIDER = None
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PackageStorage(object):
|
||||
class PackageStorage(object, metaclass=abc.ABCMeta):
|
||||
"""PackageStorage interface."""
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -18,7 +18,6 @@ import sys
|
||||
import warnings
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from qinling import exceptions as exc
|
||||
from qinling import version
|
||||
@ -84,7 +83,7 @@ def convert_dict_to_string(d):
|
||||
def datetime_to_str(dct, attr_name):
|
||||
"""Convert datetime object in dict to string."""
|
||||
if (dct.get(attr_name) is not None and
|
||||
not isinstance(dct.get(attr_name), six.string_types)):
|
||||
not isinstance(dct.get(attr_name), str)):
|
||||
dct[attr_name] = dct[attr_name].strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||
|
||||
|
||||
|
@ -16,14 +16,13 @@ import datetime
|
||||
import croniter
|
||||
from dateutil import parser
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from qinling import exceptions as exc
|
||||
|
||||
|
||||
def validate_next_time(next_execution_time):
|
||||
next_time = next_execution_time
|
||||
if isinstance(next_execution_time, six.string_types):
|
||||
if isinstance(next_execution_time, str):
|
||||
try:
|
||||
# We need naive datetime object.
|
||||
next_time = parser.parse(next_execution_time, ignoretz=True)
|
||||
|
@ -17,7 +17,6 @@ import json
|
||||
|
||||
from oslo_log import log as logging
|
||||
import pecan
|
||||
import six
|
||||
import webob
|
||||
from wsme import exc as wsme_exc
|
||||
|
||||
@ -44,9 +43,9 @@ def wrap_wsme_controller_exception(func):
|
||||
except exc.QinlingException as e:
|
||||
pecan.response.translatable_error = e
|
||||
|
||||
LOG.error('Error during API call: %s', six.text_type(e))
|
||||
LOG.error('Error during API call: %s', str(e))
|
||||
raise wsme_exc.ClientSideError(
|
||||
msg=six.text_type(e),
|
||||
msg=str(e),
|
||||
status_code=e.http_code
|
||||
)
|
||||
|
||||
@ -65,11 +64,11 @@ def wrap_pecan_controller_exception(func):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except exc.QinlingException as e:
|
||||
LOG.error('Error during API call: %s', six.text_type(e))
|
||||
LOG.error('Error during API call: %s', str(e))
|
||||
return webob.Response(
|
||||
status=e.http_code,
|
||||
content_type='application/json',
|
||||
body=json.dumps(dict(faultstring=six.text_type(e))),
|
||||
body=json.dumps(dict(faultstring=str(e))),
|
||||
charset='UTF-8'
|
||||
)
|
||||
|
||||
@ -86,7 +85,7 @@ def get_filters(**params):
|
||||
|
||||
for column, data in params.items():
|
||||
if data is not None:
|
||||
if isinstance(data, six.string_types):
|
||||
if isinstance(data, str):
|
||||
f_type, value = _extract_filter_type_and_value(data)
|
||||
create_or_update_filter(column, value, f_type, filters)
|
||||
else:
|
||||
@ -128,7 +127,7 @@ def _extract_filter_type_and_value(data):
|
||||
prefix = filter_type + ':'
|
||||
prefix_len = len(prefix)
|
||||
if data.startswith(prefix):
|
||||
value = six.text_type(data[prefix_len:])
|
||||
value = str(data[prefix_len:])
|
||||
if filter_type in LIST_VALUE_FILTER_TYPES:
|
||||
value = list(value.split(','))
|
||||
return filter_type, value
|
||||
|
@ -13,11 +13,11 @@
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import urllib
|
||||
|
||||
import six
|
||||
from tempest.lib.common import rest_client
|
||||
|
||||
urlparse = six.moves.urllib.parse
|
||||
urlparse = urllib.parse
|
||||
|
||||
|
||||
class QinlingClientBase(rest_client.RestClient):
|
||||
|
@ -19,7 +19,6 @@ oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
|
||||
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 # BSD
|
||||
setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL
|
||||
six>=1.10.0 # MIT
|
||||
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
|
||||
sqlalchemy-migrate>=0.11.0 # Apache-2.0
|
||||
stevedore>=1.20.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user