Remove six library from dependencies
Since we're not testing or supporting Python 2 anymore, we can convert six calls to Python 3 and get rid of it. Change-Id: I474c01ab6ed60aecf16524935f2866e76a66569a
This commit is contained in:
parent
20b922357e
commit
a55d153635
|
@ -83,7 +83,6 @@ requestsexceptions==1.2.0
|
||||||
rfc3986==0.3.1
|
rfc3986==0.3.1
|
||||||
Routes==2.3.1
|
Routes==2.3.1
|
||||||
simplejson==3.5.1
|
simplejson==3.5.1
|
||||||
six==1.10.0
|
|
||||||
smmap==0.9.0
|
smmap==0.9.0
|
||||||
snowballstemmer==1.2.1
|
snowballstemmer==1.2.1
|
||||||
Sphinx==1.6.2
|
Sphinx==1.6.2
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
from keystoneauth1 import exceptions as ksa_exceptions
|
from keystoneauth1 import exceptions as ksa_exceptions
|
||||||
from keystoneauth1 import session as ksa_session
|
from keystoneauth1 import session as ksa_session
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
|
@ -90,7 +89,7 @@ class BaseAPI(object):
|
||||||
:return: The modified endpoint
|
:return: The modified endpoint
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if isinstance(endpoint, six.string_types):
|
if isinstance(endpoint, str):
|
||||||
return endpoint.rstrip('/')
|
return endpoint.rstrip('/')
|
||||||
else:
|
else:
|
||||||
return endpoint
|
return endpoint
|
||||||
|
|
|
@ -18,7 +18,6 @@ import logging
|
||||||
from openstack.config import exceptions as sdk_exceptions
|
from openstack.config import exceptions as sdk_exceptions
|
||||||
from openstack.config import loader as config
|
from openstack.config import loader as config
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -158,7 +157,7 @@ class OSC_Config(config.OpenStackConfig):
|
||||||
|
|
||||||
if LOG.isEnabledFor(logging.DEBUG):
|
if LOG.isEnabledFor(logging.DEBUG):
|
||||||
LOG.debug("auth_config_hook(): %s",
|
LOG.debug("auth_config_hook(): %s",
|
||||||
strutils.mask_password(six.text_type(config)))
|
strutils.mask_password(str(config)))
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def _validate_auth(self, config, loader, fixed_argparse=None):
|
def _validate_auth(self, config, loader, fixed_argparse=None):
|
||||||
|
|
|
@ -17,12 +17,10 @@
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
|
|
||||||
from openstack.config import loader as config # noqa
|
from openstack.config import loader as config # noqa
|
||||||
from openstack import connection
|
from openstack import connection
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib.api import auth
|
from osc_lib.api import auth
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
|
@ -48,8 +46,7 @@ class ClientCache(object):
|
||||||
except AttributeError as err:
|
except AttributeError as err:
|
||||||
# Make sure the failure propagates. Otherwise, the plugin just
|
# Make sure the failure propagates. Otherwise, the plugin just
|
||||||
# quietly isn't there.
|
# quietly isn't there.
|
||||||
new_err = exceptions.PluginAttributeError(err)
|
raise exceptions.PluginAttributeError(err) from err
|
||||||
six.reraise(new_err.__class__, new_err, sys.exc_info()[2])
|
|
||||||
return self._handle
|
return self._handle
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import logging
|
||||||
from cliff import command
|
from cliff import command
|
||||||
from cliff import lister
|
from cliff import lister
|
||||||
from cliff import show
|
from cliff import show
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
|
@ -33,8 +32,7 @@ class CommandMeta(abc.ABCMeta):
|
||||||
return super(CommandMeta, mcs).__new__(mcs, name, bases, cls_dict)
|
return super(CommandMeta, mcs).__new__(mcs, name, bases, cls_dict)
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(CommandMeta)
|
class Command(command.Command, metaclass=CommandMeta):
|
||||||
class Command(command.Command):
|
|
||||||
|
|
||||||
def run(self, parsed_args):
|
def run(self, parsed_args):
|
||||||
self.log.debug('run(%s)', parsed_args)
|
self.log.debug('run(%s)', parsed_args)
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"""Command-line interface to the OpenStack APIs"""
|
"""Command-line interface to the OpenStack APIs"""
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
import locale
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -28,7 +27,6 @@ from cliff import complete
|
||||||
from cliff import help
|
from cliff import help
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib.cli import client_config as cloud_config
|
from osc_lib.cli import client_config as cloud_config
|
||||||
from osc_lib import clientmanager
|
from osc_lib import clientmanager
|
||||||
|
@ -522,12 +520,6 @@ class OpenStackShell(app.App):
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
if argv is None:
|
if argv is None:
|
||||||
argv = sys.argv[1:]
|
argv = sys.argv[1:]
|
||||||
if six.PY2:
|
|
||||||
# Emulate Py3, decode argv into Unicode based on locale so that
|
|
||||||
# commands always see arguments as text instead of binary data
|
|
||||||
encoding = locale.getpreferredencoding()
|
|
||||||
if encoding:
|
|
||||||
argv = map(lambda arg: arg.decode(encoding), argv)
|
|
||||||
return OpenStackShell().run(argv)
|
return OpenStackShell().run(argv)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import sys
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from keystoneauth1 import fixture
|
from keystoneauth1 import fixture
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
AUTH_TOKEN = "foobar"
|
AUTH_TOKEN = "foobar"
|
||||||
|
@ -178,7 +177,7 @@ class FakeResource(object):
|
||||||
self._loaded = loaded
|
self._loaded = loaded
|
||||||
|
|
||||||
def _add_details(self, info):
|
def _add_details(self, info):
|
||||||
for (k, v) in six.iteritems(info):
|
for (k, v) in info.items():
|
||||||
setattr(self, k, v)
|
setattr(self, k, v)
|
||||||
|
|
||||||
def _add_methods(self, methods):
|
def _add_methods(self, methods):
|
||||||
|
@ -189,7 +188,7 @@ class FakeResource(object):
|
||||||
@value. When users access the attribute with (), @value will be
|
@value. When users access the attribute with (), @value will be
|
||||||
returned, which looks like a function call.
|
returned, which looks like a function call.
|
||||||
"""
|
"""
|
||||||
for (name, ret) in six.iteritems(methods):
|
for (name, ret) in methods.items():
|
||||||
method = mock.MagicMock(return_value=ret)
|
method = mock.MagicMock(return_value=ret)
|
||||||
setattr(self, name, method)
|
setattr(self, name, method)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ from openstack.config import cloud_region
|
||||||
from openstack.config import defaults
|
from openstack.config import defaults
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
from requests_mock.contrib import fixture
|
from requests_mock.contrib import fixture
|
||||||
import six
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from osc_lib import clientmanager
|
from osc_lib import clientmanager
|
||||||
|
@ -121,11 +120,7 @@ class TestCase(testtools.TestCase):
|
||||||
with super(TestCase, self).subTest(*args, **kwargs):
|
with super(TestCase, self).subTest(*args, **kwargs):
|
||||||
yield
|
yield
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# NOTE(elhararb): subTest is supported by unittest only from PY3.4
|
raise
|
||||||
if six.PY2:
|
|
||||||
yield
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# TODO(elhararb): remove this except clause when subTest is
|
# TODO(elhararb): remove this except clause when subTest is
|
||||||
# enabled in testtools
|
# enabled in testtools
|
||||||
|
|
|
@ -18,7 +18,6 @@ from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from cliff import columns as cliff_columns
|
from cliff import columns as cliff_columns
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib.cli import format_columns
|
from osc_lib.cli import format_columns
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
|
@ -206,11 +205,7 @@ class TestUtils(test_utils.TestCase):
|
||||||
item4 = {'a': 1}
|
item4 = {'a': 1}
|
||||||
items = [item1, item2, item3, item4]
|
items = [item1, item2, item3, item4]
|
||||||
sort_str = 'a'
|
sort_str = 'a'
|
||||||
expect_items = [item3, item4, item1, item2]
|
self.assertRaises(TypeError, utils.sort_items, items, sort_str)
|
||||||
if six.PY2:
|
|
||||||
self.assertEqual(expect_items, utils.sort_items(items, sort_str))
|
|
||||||
else:
|
|
||||||
self.assertRaises(TypeError, utils.sort_items, items, sort_str)
|
|
||||||
|
|
||||||
def test_sort_items_with_different_type_int(self):
|
def test_sort_items_with_different_type_int(self):
|
||||||
item1 = {'a': 2}
|
item1 = {'a': 2}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import warnings
|
||||||
|
|
||||||
from cliff import columns as cliff_columns
|
from cliff import columns as cliff_columns
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
|
@ -51,7 +50,7 @@ def backward_compat_col_lister(column_headers, columns, column_map):
|
||||||
# volume v1, convert it to a list in order to change
|
# volume v1, convert it to a list in order to change
|
||||||
# the column name.
|
# the column name.
|
||||||
column_headers = list(column_headers)
|
column_headers = list(column_headers)
|
||||||
for old_col, new_col in six.iteritems(column_map):
|
for old_col, new_col in column_map.items():
|
||||||
if old_col in columns:
|
if old_col in columns:
|
||||||
LOG.warning(_('The column "%(old_column)s" was deprecated, '
|
LOG.warning(_('The column "%(old_column)s" was deprecated, '
|
||||||
'please use "%(new_column)s" replace.') % {
|
'please use "%(new_column)s" replace.') % {
|
||||||
|
@ -79,7 +78,7 @@ def backward_compat_col_showone(show_object, columns, column_map):
|
||||||
return show_object
|
return show_object
|
||||||
|
|
||||||
show_object = copy.deepcopy(show_object)
|
show_object = copy.deepcopy(show_object)
|
||||||
for old_col, new_col in six.iteritems(column_map):
|
for old_col, new_col in column_map.items():
|
||||||
if old_col in columns:
|
if old_col in columns:
|
||||||
LOG.warning(_('The column "%(old_column)s" was deprecated, '
|
LOG.warning(_('The column "%(old_column)s" was deprecated, '
|
||||||
'please use "%(new_column)s" replace.') % {
|
'please use "%(new_column)s" replace.') % {
|
||||||
|
@ -316,7 +315,7 @@ def format_dict(data, prefix=None):
|
||||||
# is completely handled in the terminal case.
|
# is completely handled in the terminal case.
|
||||||
output = output + format_dict(data[s], prefix=key_str) + ", "
|
output = output + format_dict(data[s], prefix=key_str) + ", "
|
||||||
elif data[s] is not None:
|
elif data[s] is not None:
|
||||||
output = output + key_str + "='" + six.text_type(data[s]) + "', "
|
output = output + key_str + "='" + str(data[s]) + "', "
|
||||||
else:
|
else:
|
||||||
output = output + key_str + "=, "
|
output = output + key_str + "=, "
|
||||||
return output[:-2]
|
return output[:-2]
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
# of appearance. Changing the order has an impact on the overall integration
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||||
six>=1.10.0 # MIT
|
|
||||||
|
|
||||||
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
||||||
keystoneauth1>=3.14.0 # Apache-2.0
|
keystoneauth1>=3.14.0 # Apache-2.0
|
||||||
|
|
Loading…
Reference in New Issue