diff --git a/murano/engine/package_loader.py b/murano/engine/package_loader.py index 78fe67811..6dd197ab9 100644 --- a/murano/engine/package_loader.py +++ b/murano/engine/package_loader.py @@ -30,9 +30,9 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_log import versionutils from oslo_utils import fileutils -import six from murano.common import auth_utils +from murano.common import utils from murano.dsl import constants from murano.dsl import exceptions from murano.dsl import helpers @@ -133,9 +133,9 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): self._lock_usage(package_definition) except LookupError: exc_info = sys.exc_info() - six.reraise(exceptions.NoPackageForClassFound, - exceptions.NoPackageForClassFound(class_name), - exc_info[2]) + utils.reraise(exceptions.NoPackageForClassFound, + exceptions.NoPackageForClassFound(class_name), + exc_info[2]) return self._to_dsl_package( self._get_package_by_definition(package_definition)) @@ -159,9 +159,9 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): self._lock_usage(package_definition) except LookupError: exc_info = sys.exc_info() - six.reraise(exceptions.NoPackageFound, - exceptions.NoPackageFound(package_name), - exc_info[2]) + utils.reraise(exceptions.NoPackageFound, + exceptions.NoPackageFound(package_name), + exc_info[2]) else: package = self._get_package_by_definition(package_definition) self._fixations[package_name].add(package.version) @@ -269,9 +269,9 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): package_id, str(e) ) exc_info = sys.exc_info() - six.reraise(pkg_exc.PackageLoadError, - pkg_exc.PackageLoadError(msg), - exc_info[2]) + utils.reraise(pkg_exc.PackageLoadError, + pkg_exc.PackageLoadError(msg), + exc_info[2]) package_file = None try: with tempfile.NamedTemporaryFile(delete=False) as package_file: @@ -294,9 +294,9 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): except IOError: msg = 'Unable to extract package data for %s' % package_id exc_info = sys.exc_info() - six.reraise(pkg_exc.PackageLoadError, - pkg_exc.PackageLoadError(msg), - exc_info[2]) + utils.reraise(pkg_exc.PackageLoadError, + pkg_exc.PackageLoadError(msg), + exc_info[2]) finally: try: if package_file: diff --git a/murano/engine/system/agent.py b/murano/engine/system/agent.py index 60f3dc066..2658a4edc 100644 --- a/murano/engine/system/agent.py +++ b/murano/engine/system/agent.py @@ -18,6 +18,7 @@ import datetime import os import os.path import time +import urllib import uuid from cryptography.hazmat.backends import default_backend @@ -28,7 +29,6 @@ import eventlet.event from oslo_config import cfg from oslo_log import log as logging from oslo_serialization import base64 -import six from yaql import specs import murano.common.exceptions as exceptions @@ -306,7 +306,7 @@ class Agent(object): def _is_url(self, file): file = self._get_url(file) - parts = six.moves.urllib.parse.urlsplit(file) + parts = urllib.parse.urlsplit(file) if not parts.scheme or not parts.netloc: return False else: diff --git a/murano/engine/system/status_reporter.py b/murano/engine/system/status_reporter.py index dda848d97..80298231e 100644 --- a/murano/engine/system/status_reporter.py +++ b/murano/engine/system/status_reporter.py @@ -19,7 +19,6 @@ import socket from oslo_config import cfg from oslo_log import log as logging import oslo_messaging as messaging -import six from murano.common import uuidutils from murano.dsl import dsl @@ -40,7 +39,7 @@ class StatusReporter(object): StatusReporter.transport, publisher_id=uuidutils.generate_uuid(), topics=['murano']) - if isinstance(environment, six.string_types): + if isinstance(environment, str): self._environment_id = environment else: self._environment_id = environment.id diff --git a/murano/engine/system/yaql_functions.py b/murano/engine/system/yaql_functions.py index 41367fd06..99bcdcd13 100644 --- a/murano/engine/system/yaql_functions.py +++ b/murano/engine/system/yaql_functions.py @@ -24,7 +24,6 @@ import jsonpointer from oslo_config import cfg as oslo_cfg from oslo_log import log as logging from oslo_serialization import base64 -import six from yaql.language import specs from yaql.language import utils from yaql.language import yaqltypes @@ -67,7 +66,7 @@ def pselect(collection, composer): @specs.parameter('mappings', collections.Mapping) @specs.extension_method def bind(obj, mappings): - if isinstance(obj, six.string_types) and obj.startswith('$'): + if isinstance(obj, str) and obj.startswith('$'): value = _convert_macro_parameter(obj[1:], mappings) if value is not None: return value @@ -78,7 +77,7 @@ def bind(obj, mappings): for key, value in obj.items(): result[bind(key, mappings)] = bind(value, mappings) return result - elif isinstance(obj, six.string_types) and obj.startswith('$'): + elif isinstance(obj, str) and obj.startswith('$'): value = _convert_macro_parameter(obj[1:], mappings) if value is not None: return value @@ -90,7 +89,7 @@ def _convert_macro_parameter(macro, mappings): def replace(match): replaced[0] = True - return six.text_type(mappings.get(match.group(1))) + return str(mappings.get(match.group(1))) result = re.sub('{(\\w+?)}', replace, macro) if replaced[0]: diff --git a/murano/tests/unit/engine/test_mock_context_manager.py b/murano/tests/unit/engine/test_mock_context_manager.py index 38e33b588..8acdabba7 100644 --- a/murano/tests/unit/engine/test_mock_context_manager.py +++ b/murano/tests/unit/engine/test_mock_context_manager.py @@ -11,7 +11,6 @@ # under the License. import mock -import six from yaql import contexts from yaql import specs @@ -51,7 +50,7 @@ class TestMockContextManager(mock_context_manager.MockContextManager): class MockRunner(runner.Runner): def __init__(self, model, package_loader, functions): - if isinstance(model, six.string_types): + if isinstance(model, str): model = om.Object(model) model = om.build_model(model) if 'Objects' not in model: diff --git a/murano/tests/unit/test_engine.py b/murano/tests/unit/test_engine.py index c0bf036d8..cf1087829 100644 --- a/murano/tests/unit/test_engine.py +++ b/murano/tests/unit/test_engine.py @@ -17,7 +17,6 @@ import re import mock import semantic_version -import six import yaql from yaql.language import exceptions from yaql.language import utils @@ -100,7 +99,7 @@ class TestHelperFunctions(base.MuranoTestCase): yaql_value = mock.Mock(yaql_expression.YaqlExpression, return_value='atom') complex_value = {yaql_value: ['some', (1, yaql_value), 'hi!'], - 'sample': [yaql_value, six.moves.range(5)]} + 'sample': [yaql_value, range(5)]} complex_literal = utils.FrozenDict({ 'atom': ('some', (1, 'atom'), 'hi!'), 'sample': ('atom', (0, 1, 2, 3, 4))