diff --git a/murano/api/middleware/fault.py b/murano/api/middleware/fault.py index ac2f784ef..4ffa90b22 100644 --- a/murano/api/middleware/fault.py +++ b/murano/api/middleware/fault.py @@ -18,7 +18,6 @@ import sys import traceback from oslo_config import cfg -import six import webob from murano.common import wsgi @@ -96,7 +95,7 @@ class FaultWrapper(wsgi.Middleware): ex_type = ex.__class__.__name__ - full_message = six.text_type(ex) + full_message = str(ex) if full_message.find('\n') > -1: message, msg_trace = full_message.split('\n', 1) else: diff --git a/murano/api/v1/environments.py b/murano/api/v1/environments.py index 6f128ef80..e79728853 100644 --- a/murano/api/v1/environments.py +++ b/murano/api/v1/environments.py @@ -17,7 +17,6 @@ import datetime import jsonpatch from oslo_db import exception as db_exc from oslo_log import log as logging -import six from sqlalchemy import desc from webob import exc @@ -83,7 +82,7 @@ class Controller(object): LOG.error(msg) raise exc.HTTPBadRequest(explanation=msg) - name = six.text_type(body['name']) + name = str(body['name']) if len(name) > 255: msg = _('Environment name should be 255 characters maximum') LOG.error(msg) @@ -144,7 +143,7 @@ class Controller(object): session = db_session.get_session() environment = session.query(models.Environment).get(environment_id) - new_name = six.text_type(body['name']) + new_name = str(body['name']) if new_name.strip(): if len(new_name) > 255: msg = _('Environment name should be 255 characters maximum') diff --git a/murano/api/v1/schemas.py b/murano/api/v1/schemas.py index 3e42bdf60..7fea74fa4 100644 --- a/murano/api/v1/schemas.py +++ b/murano/api/v1/schemas.py @@ -14,7 +14,6 @@ from oslo_log import log as logging from oslo_messaging.rpc import client -import six from webob import exc from murano.api.v1 import request_statistics @@ -42,7 +41,7 @@ class Controller(object): try: methods = (list( - six.moves.map(six.text_type.strip, method_names.split(','))) + map(str.strip, method_names.split(','))) if method_names else []) return rpc.engine().generate_schema( credentials, class_name, methods, diff --git a/murano/api/v1/static_actions.py b/murano/api/v1/static_actions.py index c86357b72..7a1556dc7 100644 --- a/murano/api/v1/static_actions.py +++ b/murano/api/v1/static_actions.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from oslo_log import log as logging from oslo_messaging.rpc import client from webob import exc @@ -71,8 +69,8 @@ class Controller(object): except ValueError as e: LOG.error('Exception during call of the method {method_name}: ' '{exc}'.format(method_name=method_name, - exc=six.text_type(e))) - raise exc.HTTPBadRequest(six.text_type(e)) + exc=str(e))) + raise exc.HTTPBadRequest(str(e)) def create_resource(): diff --git a/murano/api/v1/templates.py b/murano/api/v1/templates.py index 2bcc794b3..8b0825b56 100644 --- a/murano/api/v1/templates.py +++ b/murano/api/v1/templates.py @@ -14,7 +14,6 @@ from oslo_db import exception as db_exc from oslo_log import log as logging -import six from webob import exc from murano.api.v1 import request_statistics @@ -281,7 +280,7 @@ class Controller(object): LOG.error(msg) raise exc.HTTPBadRequest(explanation=msg) - name = six.text_type(body['name']) + name = str(body['name']) if len(name) > 255: msg = _('Environment template name should be 255 characters ' 'maximum') diff --git a/murano/api/versions.py b/murano/api/versions.py index 1873d051a..f3e5efaf0 100644 --- a/murano/api/versions.py +++ b/murano/api/versions.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +from http import client as http_client from oslo_serialization import jsonutils -from six.moves import http_client import webob.dec from murano.common import wsgi diff --git a/murano/tests/unit/api/base.py b/murano/tests/unit/api/base.py index 9e58be2cd..9440b67d4 100644 --- a/murano/tests/unit/api/base.py +++ b/murano/tests/unit/api/base.py @@ -19,7 +19,7 @@ import fixtures import mock from oslo_utils import timeutils import routes -from six.moves import urllib +import urllib import webob from murano.api.v1 import request_statistics diff --git a/murano/tests/unit/api/cmd/test_test_runner.py b/murano/tests/unit/api/cmd/test_test_runner.py index a650d09bb..f631831a2 100644 --- a/murano/tests/unit/api/cmd/test_test_runner.py +++ b/murano/tests/unit/api/cmd/test_test_runner.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +from io import StringIO import os import sys @@ -18,7 +19,6 @@ import mock from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils -import six import testtools from murano.cmd import test_runner @@ -58,8 +58,8 @@ class TestCaseShell(testtools.TestCase): self.addCleanup(CONF.clear_override, name, group) def shell(self, cmd_args=None, exitcode=0): - stdout = six.StringIO() - stderr = six.StringIO() + stdout = StringIO() + stderr = StringIO() args = self.args if cmd_args: cmd_args = cmd_args.split() @@ -89,10 +89,7 @@ class TestCaseShell(testtools.TestCase): def test_version(self): stdout, stderr = self.shell('--version') - if six.PY3: - output = stdout - else: - output = stderr + output = stdout self.assertIn(version.version_string, output) @mock.patch.object(test_runner, 'LOG') @@ -171,10 +168,7 @@ class TestCaseShell(testtools.TestCase): def test_package_is_not_provided(self): _, stderr = self.shell(exitcode=2) - if six.PY3: - err = 'the following arguments are required: ' - else: - err = 'too few arguments' + err = 'the following arguments are required: ' self.assertIn('murano-test-runner: error: %s' % err, stderr) def test_wrong_parent(self): diff --git a/murano/tests/unit/api/v1/test_catalog.py b/murano/tests/unit/api/v1/test_catalog.py index ff438d85f..f1ed66953 100644 --- a/murano/tests/unit/api/v1/test_catalog.py +++ b/murano/tests/unit/api/v1/test_catalog.py @@ -16,6 +16,7 @@ import cgi from datetime import datetime import imghdr +from io import StringIO import os import tempfile import uuid @@ -24,9 +25,6 @@ import mock from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import timeutils -import six -from six.moves import cStringIO -from six.moves import range from webob import exc from murano.api.v1 import catalog @@ -1119,7 +1117,7 @@ class TestCatalogApi(test_base.ControllerTest, test_base.MuranoApiTestCase): self.expect_policy_check('upload_package') self.expect_policy_check('publicize_package') - file_obj_str = cStringIO("This is some dummy data") + file_obj_str = StringIO("This is some dummy data") file_obj = mock.MagicMock(cgi.FieldStorage) file_obj.file = file_obj_str package_from_dir, _ = self._test_package() @@ -1139,8 +1137,7 @@ This is a fake zip archive def format_body(content): content = jsonutils.dumps(content) body = body_fmt.format(content) - if six.PY3: - body = body.encode('utf-8') + body = body.encode('utf-8') return body with mock.patch('murano.packages.load_utils.load_from_file') as lff: @@ -1188,7 +1185,7 @@ This is a fake zip archive self._set_policy_rules({'upload_package': '@'}) self.expect_policy_check('upload_package') - file_obj_str = cStringIO("This is some dummy data") + file_obj_str = StringIO("This is some dummy data") file_obj = mock.MagicMock(cgi.FieldStorage) file_obj.file = file_obj_str package_from_dir, _ = self._test_package() @@ -1208,8 +1205,7 @@ This is a fake zip archive def format_body(content): content = jsonutils.dumps(content) body = body_fmt.format(content) - if six.PY3: - body = body.encode('utf-8') + body = body.encode('utf-8') return body with mock.patch('murano.packages.load_utils.load_from_file') as lff: