diff --git a/lower-constraints.txt b/lower-constraints.txt index dd6ef25a..df810950 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -82,7 +82,6 @@ requestsexceptions==1.2.0 rfc3986==0.3.1 setuptools==21.0.0 simplejson==3.5.1 -six==1.10.0 snowballstemmer==1.2.1 stestr==2.0.0 stevedore==1.20.0 diff --git a/requirements.txt b/requirements.txt index d7649720..d5719afe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,3 @@ oslo.utils>=3.33.0 # Apache-2.0 python-heatclient>=1.10.0 # Apache-2.0 PyYAML>=3.12 # MIT requests>=2.14.2 # Apache-2.0 -six>=1.10.0 # MIT diff --git a/senlinclient/common/exc.py b/senlinclient/common/exc.py index 3be64224..2d886999 100644 --- a/senlinclient/common/exc.py +++ b/senlinclient/common/exc.py @@ -15,7 +15,6 @@ from keystoneauth1.exceptions import http as kae_http from openstack import exceptions as sdkexc from oslo_serialization import jsonutils from requests import exceptions as reqexc -import six from senlinclient.common.i18n import _ @@ -272,7 +271,7 @@ def parse_exception(exc): } } - elif isinstance(exc, six.string_types): + elif isinstance(exc, str): record = jsonutils.loads(exc) # some exception from keystoneauth1 is not shaped by SDK elif isinstance(exc, kae_http.HttpError): diff --git a/senlinclient/common/utils.py b/senlinclient/common/utils.py index 407848e4..93ccebfd 100644 --- a/senlinclient/common/utils.py +++ b/senlinclient/common/utils.py @@ -17,7 +17,6 @@ from heatclient.common import template_utils from oslo_serialization import jsonutils from oslo_utils import importutils import prettytable -import six import yaml from senlinclient.common import exc @@ -42,7 +41,7 @@ def format_nested_dict(d, fields, column_names): keys = sorted(d.keys()) for field in keys: value = d[field] - if not isinstance(value, six.string_types): + if not isinstance(value, str): value = jsonutils.dumps(value, indent=2, ensure_ascii=False) if value is None: value = '-' @@ -122,7 +121,7 @@ def get_spec_content(filename): data = yaml.safe_load(f) except Exception as ex: raise exc.CommandError(_('The specified file is not a valid ' - 'YAML file: %s') % six.text_type(ex)) + 'YAML file: %s') % str(ex)) return data @@ -133,7 +132,7 @@ def process_stack_spec(spec): tmplfile = spec.get('template', None) except AttributeError as ex: raise exc.FileFormatError(_('The specified file is not a valid ' - 'YAML file: %s') % six.text_type(ex)) + 'YAML file: %s') % str(ex)) if not tmplfile: raise exc.FileFormatError(_('No template found in the given ' 'spec file')) diff --git a/senlinclient/tests/functional/base.py b/senlinclient/tests/functional/base.py index c9a7d103..f44c8073 100644 --- a/senlinclient/tests/functional/base.py +++ b/senlinclient/tests/functional/base.py @@ -11,7 +11,6 @@ # under the License. import os -import six import time from oslo_utils import uuidutils @@ -46,7 +45,7 @@ class OpenStackClientTestBase(base.ClientTestBase): obj = {} items = self.parser.listing(output) for item in items: - obj[item['Field']] = six.text_type(item['Value']) + obj[item['Field']] = str(item['Value']) return dict((self._key_name(k), v) for k, v in obj.items()) def _key_name(self, key): diff --git a/senlinclient/tests/unit/test_utils.py b/senlinclient/tests/unit/test_utils.py index 122def07..e362d677 100644 --- a/senlinclient/tests/unit/test_utils.py +++ b/senlinclient/tests/unit/test_utils.py @@ -13,7 +13,6 @@ from heatclient.common import template_utils from unittest import mock -import six import testtools from senlinclient.common import exc @@ -49,7 +48,7 @@ class UtilTest(testtools.TestCase): params) msg = _('Malformed parameter(status:ACTIVE). ' 'Use the key=value format.') - self.assertEqual(msg, six.text_type(ex)) + self.assertEqual(msg, str(ex)) @mock.patch.object(template_utils, 'process_multiple_environments_and_files') diff --git a/senlinclient/tests/unit/v1/test_cluster.py b/senlinclient/tests/unit/v1/test_cluster.py index b0a749c3..239533a0 100644 --- a/senlinclient/tests/unit/v1/test_cluster.py +++ b/senlinclient/tests/unit/v1/test_cluster.py @@ -11,12 +11,12 @@ # under the License. import copy +import io import subprocess from unittest import mock from openstack import exceptions as sdk_exc from osc_lib import exceptions as exc -import six from senlinclient.tests.unit.v1 import fakes from senlinclient.v1 import cluster as osc_cluster @@ -393,7 +393,7 @@ class TestClusterDelete(TestCluster): mock.call('cluster2', False, False)] ) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_cluster_delete_prompt_yes(self, mock_stdin): arglist = ['my_cluster'] mock_stdin.isatty.return_value = True @@ -406,7 +406,7 @@ class TestClusterDelete(TestCluster): self.mock_client.delete_cluster.assert_called_with( 'my_cluster', False, False) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_cluster_delete_prompt_no(self, mock_stdin): arglist = ['my_cluster'] mock_stdin.isatty.return_value = True diff --git a/senlinclient/tests/unit/v1/test_node.py b/senlinclient/tests/unit/v1/test_node.py index 1b2a61c6..971ac5f3 100644 --- a/senlinclient/tests/unit/v1/test_node.py +++ b/senlinclient/tests/unit/v1/test_node.py @@ -11,11 +11,11 @@ # under the License. import copy +import io from unittest import mock from openstack import exceptions as sdk_exc from osc_lib import exceptions as exc -import six from senlinclient.tests.unit.v1 import fakes from senlinclient.v1 import node as osc_node @@ -394,7 +394,7 @@ class TestNodeDelete(TestNode): mock.call('node2', False, False)] ) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_node_delete_prompt_yes(self, mock_stdin): arglist = ['my_node'] mock_stdin.isatty.return_value = True @@ -407,7 +407,7 @@ class TestNodeDelete(TestNode): self.mock_client.delete_node.assert_called_with( 'my_node', False, False) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_node_delete_prompt_no(self, mock_stdin): arglist = ['my_node'] mock_stdin.isatty.return_value = True diff --git a/senlinclient/tests/unit/v1/test_policy.py b/senlinclient/tests/unit/v1/test_policy.py index 565f7801..27b4b189 100644 --- a/senlinclient/tests/unit/v1/test_policy.py +++ b/senlinclient/tests/unit/v1/test_policy.py @@ -11,11 +11,11 @@ # under the License. import copy +import io from unittest import mock from openstack import exceptions as sdk_exc from osc_lib import exceptions as exc -import six from senlinclient.tests.unit.v1 import fakes from senlinclient.v1 import policy as osc_policy @@ -353,7 +353,7 @@ class TestPolicyDelete(TestPolicy): self.assertEqual('Failed to delete 1 of the 2 specified policy(s).', str(error)) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_policy_delete_prompt_yes(self, mock_stdin): arglist = ['my_policy'] mock_stdin.isatty.return_value = True @@ -366,7 +366,7 @@ class TestPolicyDelete(TestPolicy): self.mock_client.delete_policy.assert_called_with('my_policy', False) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_policy_delete_prompt_no(self, mock_stdin): arglist = ['my_policy'] mock_stdin.isatty.return_value = True diff --git a/senlinclient/tests/unit/v1/test_profile.py b/senlinclient/tests/unit/v1/test_profile.py index e3b974e2..6b334a5a 100644 --- a/senlinclient/tests/unit/v1/test_profile.py +++ b/senlinclient/tests/unit/v1/test_profile.py @@ -11,12 +11,12 @@ # under the License. import copy +import io from unittest import mock from openstack import exceptions as sdk_exc from osc_lib import exceptions as exc from osc_lib import utils -import six from senlinclient.tests.unit.v1 import fakes from senlinclient.v1 import profile as osc_profile @@ -264,7 +264,7 @@ class TestProfileDelete(TestProfile): self.assertEqual('Failed to delete 1 of the 2 specified profile(s).', str(error)) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_profile_delete_prompt_yes(self, mock_stdin): arglist = ['my_profile'] mock_stdin.isatty.return_value = True @@ -277,7 +277,7 @@ class TestProfileDelete(TestProfile): self.mock_client.delete_profile.assert_called_with('my_profile', False) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_profile_delete_prompt_no(self, mock_stdin): arglist = ['my_profile'] mock_stdin.isatty.return_value = True diff --git a/senlinclient/tests/unit/v1/test_receiver.py b/senlinclient/tests/unit/v1/test_receiver.py index 66a0dbab..a8dd9047 100644 --- a/senlinclient/tests/unit/v1/test_receiver.py +++ b/senlinclient/tests/unit/v1/test_receiver.py @@ -11,12 +11,12 @@ # under the License. import copy +import io from unittest import mock from openstack import exceptions as sdk_exc from osc_lib import exceptions as exc from osc_lib import utils -import six from senlinclient.common.i18n import _ from senlinclient.tests.unit.v1 import fakes @@ -347,7 +347,7 @@ class TestReceiverDelete(TestReceiver): self.assertEqual('Failed to delete 1 of the 2 specified receiver(s).', str(error)) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_receiver_delete_prompt_yes(self, mock_stdin): arglist = ['my_receiver'] mock_stdin.isatty.return_value = True @@ -360,7 +360,7 @@ class TestReceiverDelete(TestReceiver): self.mock_client.delete_receiver.assert_called_with('my_receiver', False) - @mock.patch('sys.stdin', spec=six.StringIO) + @mock.patch('sys.stdin', spec=io.StringIO) def test_receiver_delete_prompt_no(self, mock_stdin): arglist = ['my_receiver'] mock_stdin.isatty.return_value = True diff --git a/senlinclient/v1/cluster.py b/senlinclient/v1/cluster.py index 4b3e9eac..c37d617c 100644 --- a/senlinclient/v1/cluster.py +++ b/senlinclient/v1/cluster.py @@ -23,7 +23,6 @@ from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib import utils from oslo_utils import strutils -import six from senlinclient.common.i18n import _ from senlinclient.common import utils as senlin_utils @@ -363,7 +362,7 @@ class DeleteCluster(command.Command): cid, False, parsed_args.force_delete) result[cid] = ('OK', cluster_delete_action['id']) except Exception as ex: - result[cid] = ('ERROR', six.text_type(ex)) + result[cid] = ('ERROR', str(ex)) for rid, res in result.items(): senlin_utils.print_action_result(rid, res) diff --git a/senlinclient/v1/node.py b/senlinclient/v1/node.py index 6d1dd782..3d1d6f93 100644 --- a/senlinclient/v1/node.py +++ b/senlinclient/v1/node.py @@ -20,7 +20,6 @@ from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib import utils from oslo_utils import strutils -import six from senlinclient.common.i18n import _ from senlinclient.common import utils as senlin_utils @@ -349,7 +348,7 @@ class DeleteNode(command.Command): nid, False, parsed_args.force_delete) result[nid] = ('OK', node_delete_action['id']) except Exception as ex: - result[nid] = ('ERROR', six.text_type(ex)) + result[nid] = ('ERROR', str(ex)) for rid, res in result.items(): senlin_utils.print_action_result(rid, res)