diff --git a/contrib/plugins/cloudify_plugin/murano_cloudify_plugin/cloudify_tosca_package.py b/contrib/plugins/cloudify_plugin/murano_cloudify_plugin/cloudify_tosca_package.py index 178e7e48..1e6ae211 100644 --- a/contrib/plugins/cloudify_plugin/murano_cloudify_plugin/cloudify_tosca_package.py +++ b/contrib/plugins/cloudify_plugin/murano_cloudify_plugin/cloudify_tosca_package.py @@ -12,7 +12,6 @@ import os -import six import yaml from murano.packages import exceptions @@ -87,7 +86,7 @@ class CloudifyToscaPackage(package_base.PackageBase): @staticmethod def _generate_properties(inputs, outputs): contracts = {} - for name, value in six.iteritems(inputs): + for name, value in inputs.items(): prop = { 'Contract': YAQL('$.string().notNull()'), 'Usage': 'In' @@ -96,7 +95,7 @@ class CloudifyToscaPackage(package_base.PackageBase): prop['Default'] = value['default'] contracts[name] = prop - for name in six.iterkeys(outputs): + for name in outputs.keys(): contracts[name] = { 'Contract': YAQL('$.string()'), 'Usage': 'Out' @@ -107,7 +106,7 @@ class CloudifyToscaPackage(package_base.PackageBase): def _generate_describe_method(self, inputs): input_values = { name: YAQL('$.' + name) - for name in six.iterkeys(inputs) + for name in inputs.keys() } return { @@ -123,7 +122,7 @@ class CloudifyToscaPackage(package_base.PackageBase): def _generate_update_outputs_method(outputs): assignments = [ {YAQL('$.' + name): YAQL('$outputs.get({0})'.format(name))} - for name in six.iterkeys(outputs) + for name in outputs.keys() ] return { 'Arguments': [{ @@ -147,7 +146,7 @@ class CloudifyToscaPackage(package_base.PackageBase): package_version=None): section = { key: YAQL( - '$.appConfiguration.' + key) for key in six.iterkeys(inputs) + '$.appConfiguration.' + key) for key in inputs.keys() } section.update({ '?': { @@ -169,7 +168,7 @@ class CloudifyToscaPackage(package_base.PackageBase): 'type': 'string', 'required': True, 'description': value.get('description', key) - } for key, value in six.iteritems(inputs) + } for key, value in inputs.items() ] return [{ 'appConfiguration': { diff --git a/contrib/plugins/murano_heat-translator_plugin/plugin/csar_package.py b/contrib/plugins/murano_heat-translator_plugin/plugin/csar_package.py index d1114605..9e689453 100644 --- a/contrib/plugins/murano_heat-translator_plugin/plugin/csar_package.py +++ b/contrib/plugins/murano_heat-translator_plugin/plugin/csar_package.py @@ -396,7 +396,7 @@ class CSARPackage(package_base.PackageBase): rest_group = [] properties = [] - for key, value in six.iteritems(tosca_inputs): + for key, value in tosca_inputs.items(): if key not in used_inputs: rest_group.append(CSARPackage._translate_ui_parameter( key, value)) diff --git a/murano/api/v1/catalog.py b/murano/api/v1/catalog.py index db05bbae..b6a7e129 100644 --- a/murano/api/v1/catalog.py +++ b/murano/api/v1/catalog.py @@ -24,7 +24,6 @@ from oslo_config import cfg from oslo_db import exception as db_exc from oslo_log import log as logging from oslo_log import versionutils -import six from webob import exc import murano.api.v1 @@ -262,7 +261,7 @@ class Controller(object): tempf.name, target_dir=None, drop_dir=True) as pkg_to_upload: # extend dictionary for update db - for k, v in six.iteritems(PKG_PARAMS_MAP): + for k, v in PKG_PARAMS_MAP.items(): if hasattr(pkg_to_upload, k): package_meta[v] = getattr(pkg_to_upload, k) if len(package_meta['name']) > 80: diff --git a/murano/cfapi/cfapi.py b/murano/cfapi/cfapi.py index b634c4dd..3d23df1d 100644 --- a/murano/cfapi/cfapi.py +++ b/murano/cfapi/cfapi.py @@ -17,7 +17,6 @@ import uuid from oslo_config import cfg from oslo_log import log as logging -import six import tenacity from webob import response @@ -167,7 +166,7 @@ class Controller(object): params = [parameters] while params: a = params.pop() - for k, v in six.iteritems(a): + for k, v in a.items(): if isinstance(v, dict): params.append(v) if k == '?': diff --git a/murano/cmd/test_runner.py b/murano/cmd/test_runner.py index 640cc3a0..331bd78a 100644 --- a/murano/cmd/test_runner.py +++ b/murano/cmd/test_runner.py @@ -25,7 +25,6 @@ from oslo_db import options from oslo_log import log as logging from oslo_utils import importutils from oslo_utils import timeutils -import six from murano.common import config from murano.common import engine @@ -107,7 +106,7 @@ class MuranoTestRunner(object): # Check for method name occurrence in all methods. # if there is no dot in provided item - it is a method name if '.' not in item: - for class_name, methods in six.iteritems(class_to_methods): + for class_name, methods in class_to_methods.items(): methods_to_run[class_name] = [] if item in methods: methods_to_run[class_name].append(item) @@ -126,9 +125,9 @@ class MuranoTestRunner(object): m for m in class_to_methods[class_to_test] if m == test_method] continue - methods_count = sum(len(v) for v in six.itervalues(methods_to_run)) + methods_count = sum(len(v) for v in methods_to_run.values()) methods = [k + '.' + method - for k, v in six.iteritems(methods_to_run) for method in v] + for k, v in methods_to_run.items() for method in v] LOG.debug('{0} method(s) is(are) going to be executed: ' '\n{1}'.format(methods_count, '\n'.join(methods))) return methods_to_run @@ -187,7 +186,7 @@ class MuranoTestRunner(object): # Load keystone configuration parameters from config importutils.import_module('keystonemiddleware.auth_token') - for param, value in six.iteritems(ks_opts): + for param, value in ks_opts.items(): if not value: ks_opts[param] = getattr(CONF.keystone_authtoken, ks_opts_to_config[param]) @@ -230,7 +229,7 @@ class MuranoTestRunner(object): class_to_methods) max_length = 0 num_tests = 0 - for pkg_class, test_cases in six.iteritems(run_set): + for pkg_class, test_cases in run_set.items(): for m in test_cases: max_length = max(max_length, len(pkg_class)+len(m)+1) num_tests += len(test_cases) @@ -247,7 +246,7 @@ class MuranoTestRunner(object): run_count = 0 error_count = 0 started = timeutils.utcnow() - for pkg_class, test_cases in six.iteritems(run_set): + for pkg_class, test_cases in run_set.items(): for m in test_cases: # Create new executor for each test case to provide # pure test environment diff --git a/murano/common/plugins/extensions_loader.py b/murano/common/plugins/extensions_loader.py index d8c28f98..d2c391ad 100644 --- a/murano/common/plugins/extensions_loader.py +++ b/murano/common/plugins/extensions_loader.py @@ -17,7 +17,6 @@ import re from oslo_config import cfg from oslo_log import log as logging -import six from stevedore import dispatch from murano.dsl import murano_package @@ -70,7 +69,7 @@ class PluginLoader(object): class_name=name, dist=dist_name)) def cleanup_duplicates(self, name_map): - for class_name, package_names in six.iteritems(name_map): + for class_name, package_names in name_map.items(): if len(package_names) >= 2: LOG.warning("Class is defined in multiple packages!") for package_name in package_names: @@ -95,7 +94,7 @@ class PluginLoader(object): "{err}".format(ep=ep.name, dist=ep.dist, err=exc)) def register_in_loader(self, package_loader): - for package in six.itervalues(self.packages): + for package in self.packages.values(): package_loader.register_package( MuranoPackage(package_loader, package)) @@ -126,7 +125,7 @@ class MuranoPackage(murano_package.MuranoPackage): def __init__(self, pkg_loader, package_definition): super(MuranoPackage, self).__init__( pkg_loader, package_definition.name, runtime_version='1.0') - for class_name, clazz in six.iteritems(package_definition.classes): + for class_name, clazz in package_definition.classes.items(): if hasattr(clazz, "_murano_class_name"): LOG.warning("Class '%(class_name)s' has a MuranoPL " "name '%(name)s' defined which will be " diff --git a/murano/common/utils.py b/murano/common/utils.py index 1146c275..55378040 100644 --- a/murano/common/utils.py +++ b/murano/common/utils.py @@ -212,7 +212,7 @@ def build_entity_map(value): if isinstance(value, dict): if '?' in value and 'id' in value['?']: id_map[value['?']['id']] = value - for v in six.itervalues(value): + for v in value.values(): build_entity_map_recursive(v, id_map) if isinstance(value, list): for item in value: diff --git a/murano/common/wsgi.py b/murano/common/wsgi.py index 1ce20ee8..3466d0ab 100644 --- a/murano/common/wsgi.py +++ b/murano/common/wsgi.py @@ -224,7 +224,7 @@ class Debug(Middleware): resp = req.get_response(self.application) print(("*" * 40) + " RESPONSE HEADERS") - for (key, value) in six.iteritems(resp.headers): + for (key, value) in resp.headers.items(): print(key, "=", value) print("") @@ -497,7 +497,7 @@ class Resource(object): "X-User-Id", "X-Tenant-Id") - for header, value in six.iteritems(headers): + for header, value in headers.items(): if header.startswith("X-") and header not in useful_headers: continue string_parts.append("{0}: {1}".format(header, value)) @@ -1116,7 +1116,7 @@ class FormDataDeserializer(TextDeserializer): def default(self, request): form_data_parts = request.POST - for key, value in six.iteritems(form_data_parts): + for key, value in form_data_parts.items(): if isinstance(value, six.string_types): form_data_parts[key] = self._from_json(value) return {'body': form_data_parts} diff --git a/murano/db/catalog/api.py b/murano/db/catalog/api.py index 160b49a1..5f120e88 100644 --- a/murano/db/catalog/api.py +++ b/murano/db/catalog/api.py @@ -17,7 +17,6 @@ from oslo_db import exception as db_exceptions from oslo_db.sqlalchemy import utils from oslo_log import log as logging import re -import six import sqlalchemy as sa from sqlalchemy import or_ from sqlalchemy.orm import attributes @@ -420,7 +419,7 @@ def package_upload(values, tenant_id): _check_for_public_packages_with_fqn( session, values.get('fully_qualified_name')) - for attr, func in six.iteritems(composite_attr_to_func): + for attr, func in composite_attr_to_func.items(): if values.get(attr): result = func(values[attr], session) setattr(package, attr, result) diff --git a/murano/db/models.py b/murano/db/models.py index a5a3592c..a9f03f4a 100644 --- a/murano/db/models.py +++ b/murano/db/models.py @@ -17,7 +17,6 @@ SQLAlchemy models for murano data """ from oslo_db.sqlalchemy import models from oslo_utils import timeutils -import six import sqlalchemy as sa from sqlalchemy.ext import declarative from sqlalchemy import orm as sa_orm @@ -47,7 +46,7 @@ class TimestampMixin(object): class _MuranoBase(models.ModelBase): def to_dict(self): dictionary = self.__dict__.copy() - return dict((k, v) for k, v in six.iteritems(dictionary) + return dict((k, v) for k, v in dictionary.items() if k != '_sa_instance_state') diff --git a/murano/db/services/environments.py b/murano/db/services/environments.py index 8e7d591e..2690183b 100644 --- a/murano/db/services/environments.py +++ b/murano/db/services/environments.py @@ -254,7 +254,7 @@ class EnvironmentServices(object): if isinstance(data.get('?'), dict): data['?']['id'] = uuidutils.generate_uuid() result = {} - for key, value in six.iteritems(data): + for key, value in data.items(): result[key] = EnvironmentServices._objectify( value, replacements) return result @@ -262,7 +262,7 @@ class EnvironmentServices(object): return [EnvironmentServices._objectify(v, replacements) for v in data] elif isinstance(data, six.string_types): - for key, value in six.iteritems(replacements): + for key, value in replacements.items(): data = data.replace('%' + key + '%', value) return data diff --git a/murano/dsl/attribute_store.py b/murano/dsl/attribute_store.py index 763ec008..fef82e1b 100644 --- a/murano/dsl/attribute_store.py +++ b/murano/dsl/attribute_store.py @@ -14,7 +14,6 @@ import collections -import six from murano.dsl import dsl_types @@ -49,8 +48,8 @@ class AttributeStore(object): def serialize(self, known_objects): return [ [key1, key2[0], key2[1], value] - for key1, inner in six.iteritems(self._attributes) - for key2, value in six.iteritems(inner) + for key1, inner in self._attributes.items() + for key2, value in inner.items() if key1 in known_objects ] diff --git a/murano/dsl/contracts/contracts.py b/murano/dsl/contracts/contracts.py index 6c90c5be..b4e4fe79 100644 --- a/murano/dsl/contracts/contracts.py +++ b/murano/dsl/contracts/contracts.py @@ -14,7 +14,6 @@ import copy -import six from yaql.language import specs from yaql.language import utils from yaql.language import yaqltypes @@ -144,7 +143,7 @@ class Contract(object): return data result = {} yaql_key = None - for key, value in six.iteritems(spec): + for key, value in spec.items(): if isinstance(key, dsl_types.YaqlExpression): if yaql_key is not None: raise exceptions.DslContractSyntaxError( @@ -159,7 +158,7 @@ class Contract(object): if yaql_key is not None: yaql_value = spec[yaql_key] - for key, value in six.iteritems(data): + for key, value in data.items(): if key in result: continue key = self._map(key, yaql_key, context, path) @@ -252,7 +251,7 @@ class Contract(object): contract_context = base_context_func( self._runtime_version).create_child_context() contract_context['root_context'] = context - for key, value in six.iteritems(kwargs): + for key, value in kwargs.items(): contract_context[key] = value contract_context[constants.CTX_NAMES_SCOPE] = \ context[constants.CTX_NAMES_SCOPE] diff --git a/murano/dsl/executor.py b/murano/dsl/executor.py index a7547635..084bc158 100644 --- a/murano/dsl/executor.py +++ b/murano/dsl/executor.py @@ -138,7 +138,7 @@ class MuranoDslExecutor(object): with self._acquire_method_lock(method, this_lock, arg_values_for_lock): for i, arg in enumerate(args, 2): context[str(i)] = arg - for key, value in six.iteritems(kwargs): + for key, value in kwargs.items(): context[key] = value def call(): @@ -238,7 +238,7 @@ class MuranoDslExecutor(object): param_gen = itertools.chain( (six.text_type(arg) for arg in args), (u'{0} => {1}'.format(name, value) - for name, value in six.iteritems(kwargs))) + for name, value in kwargs.items())) params_str = u', '.join(param_gen) method_name = '::'.join((method.declaring_type.name, method.name)) thread_id = helpers.get_current_thread_id() @@ -274,7 +274,7 @@ class MuranoDslExecutor(object): vararg_values = [] kwargs_arg = None kwarg_values = {} - for name, definition in six.iteritems(arguments_scheme): + for name, definition in arguments_scheme.items(): if definition.usage == dsl_types.MethodArgumentUsages.VarArgs: varargs_arg = name parameter_values[name] = vararg_values @@ -293,7 +293,7 @@ class MuranoDslExecutor(object): else: parameter_values[name] = arg - for name, value in six.iteritems(utils.filter_parameters_dict(kwargs)): + for name, value in utils.filter_parameters_dict(kwargs).items(): if name in arguments_scheme and name not in ( varargs_arg, kwargs_arg): parameter_values[name] = value diff --git a/murano/dsl/expressions.py b/murano/dsl/expressions.py index fdc0e2d0..ef1f54f3 100644 --- a/murano/dsl/expressions.py +++ b/murano/dsl/expressions.py @@ -13,8 +13,6 @@ # under the License. -import six - from murano.dsl import dsl_exception from murano.dsl import helpers from murano.dsl import lhs_expression @@ -84,7 +82,7 @@ def parse_expression(expr): result = Statement(expr) elif isinstance(expr, dict): kwds = {} - for key, value in six.iteritems(expr): + for key, value in expr.items(): if isinstance(key, yaql_expression.YaqlExpression): if result is not None: raise ValueError() diff --git a/murano/dsl/helpers.py b/murano/dsl/helpers.py index 55895b3b..be0deab6 100644 --- a/murano/dsl/helpers.py +++ b/murano/dsl/helpers.py @@ -55,7 +55,7 @@ def evaluate(value, context, freeze=True): return dict_type( (evaluate(d_key, context, freeze), evaluate(d_value, context, freeze)) - for d_key, d_value in six.iteritems(value)) + for d_key, d_value in value.items()) elif yaqlutils.is_sequence(value): return list_type(evaluate(t, context, freeze) for t in value) elif isinstance(value, yaqlutils.SetType): @@ -574,7 +574,7 @@ def parse_object_definition(spec, scope_type, context): 'destroyed': system_data.get('destroyed', False), 'dependencies': system_data.get('dependencies', {}), 'extra': { - key: value for key, value in six.iteritems(system_data) + key: value for key, value in system_data.items() if key.startswith('_') } } diff --git a/murano/dsl/lhs_expression.py b/murano/dsl/lhs_expression.py index f14092f9..3d02e40d 100644 --- a/murano/dsl/lhs_expression.py +++ b/murano/dsl/lhs_expression.py @@ -14,7 +14,6 @@ import itertools -import six from yaql.language import specs from yaql.language import utils from yaql.language import yaqltypes @@ -52,7 +51,7 @@ def _prepare_context(): src_property.set( utils.FrozenDict( itertools.chain( - six.iteritems(src), + src.items(), ((key, value),)))) elif isinstance(src, dsl_types.MuranoObject): src.set_property(key, value, context['#root_context']) diff --git a/murano/dsl/macros.py b/murano/dsl/macros.py index 02b8f8a1..80f4464e 100644 --- a/murano/dsl/macros.py +++ b/murano/dsl/macros.py @@ -189,7 +189,7 @@ class MatchMacro(expressions.DslExpression): def execute(self, context): match_value = helpers.evaluate(self._value, context) - for key, value in six.iteritems(self._switch): + for key, value in self._switch.items(): if key == match_value: CodeBlock(value).execute(context) return @@ -207,7 +207,7 @@ class SwitchMacro(expressions.DslExpression): def execute(self, context): matched = False - for key, value in six.iteritems(self._switch): + for key, value in self._switch.items(): if helpers.evaluate(key, context): matched = True CodeBlock(value).execute(context) diff --git a/murano/dsl/murano_method.py b/murano/dsl/murano_method.py index 5783f261..ced2e9de 100644 --- a/murano/dsl/murano_method.py +++ b/murano/dsl/murano_method.py @@ -93,7 +93,7 @@ class MuranoMethod(dsl_types.MuranoMethod, meta.MetaProvider): arguments_scheme = helpers.list_value(payload.get('Arguments')) if isinstance(arguments_scheme, dict): arguments_scheme = [{key: value} for key, value in - six.iteritems(arguments_scheme)] + arguments_scheme.items()] self._arguments_scheme = collections.OrderedDict() seen_varargs = False seen_kwargs = False diff --git a/murano/dsl/murano_object.py b/murano/dsl/murano_object.py index e578969e..d9709c9e 100644 --- a/murano/dsl/murano_object.py +++ b/murano/dsl/murano_object.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six from murano.dsl import constants from murano.dsl import dsl @@ -93,7 +92,7 @@ class MuranoObject(dsl_types.MuranoObject): used_names = used_names or set() names = set(self.type.properties) if init: - names.update(six.iterkeys(init.arguments_scheme)) + names.update(init.arguments_scheme.keys()) last_errors = len(names) init_args = {} while True: @@ -376,7 +375,7 @@ class MuranoObject(dsl_types.MuranoObject): self._owner = None self._destruction_dependencies = None self._this = None - for p in six.itervalues(self._parents): + for p in self._parents.values(): p.mark_destroyed(clear_data) @property diff --git a/murano/dsl/murano_package.py b/murano/dsl/murano_package.py index 00bb219b..e5b7db22 100644 --- a/murano/dsl/murano_package.py +++ b/murano/dsl/murano_package.py @@ -50,7 +50,7 @@ class MuranoPackage(dsl_types.MuranoPackage, dslmeta.MetaProvider): semantic_version.Spec('==0') self._classes = {} self._imported_types = {object, murano_object.MuranoObject} - for key, value in six.iteritems(requirements or {}): + for key, value in (requirements or {}).items(): self._requirements[key] = helpers.parse_version_spec(value) self._load_queue = {} @@ -181,8 +181,7 @@ class MuranoPackage(dsl_types.MuranoPackage, dslmeta.MetaProvider): return result if search_requirements: pkgs_for_search = [] - for package_name, version_spec in six.iteritems( - self._requirements): + for package_name, version_spec in self._requirements.items(): if package_name == self.name: continue referenced_package = self._package_loader.load_package( diff --git a/murano/dsl/murano_type.py b/murano/dsl/murano_type.py index 8b5ce3db..bf434b15 100644 --- a/murano/dsl/murano_type.py +++ b/murano/dsl/murano_type.py @@ -263,7 +263,7 @@ class MuranoClass(dsl_types.MuranoClass, MuranoType, dslmeta.MetaProvider): def find_methods(self, predicate): result = list(filter(predicate, self.methods.values())) for c in self.ancestors(): - for method in six.itervalues(c.methods): + for method in c.methods.values(): if predicate(method) and method not in result: result.append(method) return result @@ -345,7 +345,7 @@ class MuranoClass(dsl_types.MuranoClass, MuranoType, dslmeta.MetaProvider): (parent.package, requirement)) package_bindings = {} - for versions in six.itervalues(aggregation): + for versions in aggregation.values(): mappings = self._remap_package(versions) package_bindings.update(mappings) @@ -504,7 +504,7 @@ def _create_class(cls, name, ns_resolver, data, package, *args, **kwargs): data.get('Import'), *args, **kwargs) properties = data.get('Properties') or {} - for property_name, property_spec in six.iteritems(properties): + for property_name, property_spec in properties.items(): spec = murano_property.MuranoProperty( type_obj, property_name, property_spec) type_obj.add_property(spec) @@ -516,7 +516,7 @@ def _create_class(cls, name, ns_resolver, data, package, *args, **kwargs): 'destroy': '.destroy' } - for method_name, payload in six.iteritems(methods): + for method_name, payload in methods.items(): type_obj.add_method( method_mappings.get(method_name, method_name), payload) diff --git a/murano/dsl/object_store.py b/murano/dsl/object_store.py index aac2f42f..ae4b985c 100644 --- a/murano/dsl/object_store.py +++ b/murano/dsl/object_store.py @@ -17,7 +17,6 @@ import gc import weakref from oslo_log import log as logging -import six from murano.dsl import dsl_types from murano.dsl import helpers @@ -60,7 +59,7 @@ class ObjectStore(object): self._store[murano_object.object_id] = murano_object def iterate(self): - return six.iterkeys(self._store) + return self._store.keys() def remove(self, object_id): self._store.pop(object_id) @@ -85,7 +84,7 @@ class ObjectStore(object): @staticmethod def _get_designer_attributes(header): - return dict((k, v) for k, v in six.iteritems(header) + return dict((k, v) for k, v in header.items() if str(k).startswith('_')) def designer_attributes(self, object_id): @@ -109,7 +108,7 @@ class ObjectStore(object): def prepare_finalize(self, used_objects): used_objects = set(used_objects) if used_objects else [] sentenced_objects = [ - obj for obj in six.itervalues(self._store) + obj for obj in self._store.values() if obj not in used_objects ] with helpers.with_object_store(self): diff --git a/murano/dsl/schema_generator.py b/murano/dsl/schema_generator.py index 1a743556..8c88c589 100644 --- a/murano/dsl/schema_generator.py +++ b/murano/dsl/schema_generator.py @@ -122,7 +122,7 @@ def generate_entity_schema(entity, context, declaring_type, meta): 'type': 'object', 'properties': { name: generate_property_schema(prop, context, type_weights) - for name, prop in six.iteritems(properties) + for name, prop in properties.items() }, 'additionalProperties': False, 'formSections': generate_sections(meta, type_weights) @@ -248,7 +248,7 @@ def translate_dict(contract, context, runtime_version): """Translates dictionary contracts into json-schema objects""" properties = {} additional_properties = False - for key, value in six.iteritems(contract): + for key, value in contract.items(): if isinstance(key, dsl_types.YaqlExpression): additional_properties = translate(value, context, runtime_version) else: diff --git a/murano/dsl/serializer.py b/murano/dsl/serializer.py index 6229054c..b08614e5 100644 --- a/murano/dsl/serializer.py +++ b/murano/dsl/serializer.py @@ -163,7 +163,7 @@ def _pass12_serialize(value, parent, serialized_objects, result = {} need_another_pass = False - for d_key, d_value in six.iteritems(value): + for d_key, d_value in value.items(): if (isinstance(d_key, dsl_types.MuranoType) and serialization_type == dsl_types.DumpTypes.Serializable): result_key = str(d_key) @@ -244,7 +244,7 @@ def collect_objects(root_object): for t in rec(value): yield t elif isinstance(obj, utils.MappingType): - for value in six.itervalues(obj): + for value in obj.values(): for t in rec(value): yield t elif isinstance(obj, dsl_types.MuranoObjectInterface): diff --git a/murano/dsl/yaql_functions.py b/murano/dsl/yaql_functions.py index 7eff79ae..861859d1 100644 --- a/murano/dsl/yaql_functions.py +++ b/murano/dsl/yaql_functions.py @@ -53,7 +53,7 @@ def new(__context, __type_name, __owner=None, __object_name=None, __extra=None, __type_name: parameters, 'name': __object_name } - for key, value in six.iteritems(__extra or {}): + for key, value in (__extra or {}).items(): if key.startswith('_'): data[key] = value @@ -241,7 +241,7 @@ def call_func(context, op_dot, base, name, args, kwargs, args += tuple( expressions.MappingRuleExpression(expressions.KeywordConstant(key), value) - for key, value in six.iteritems(kwargs)) + for key, value in kwargs.items()) function = expressions.Function(name, *args) return op_dot(context, receiver, function) else: diff --git a/murano/dsl/yaql_integration.py b/murano/dsl/yaql_integration.py index f3ff194f..f328c76d 100644 --- a/murano/dsl/yaql_integration.py +++ b/murano/dsl/yaql_integration.py @@ -14,7 +14,6 @@ import weakref -import six import yaql from yaql.language import contexts from yaql.language import conventions @@ -132,7 +131,7 @@ def call_func(__context, __name, *args, **kwargs): return __context(__name, engine)( *args, **{CONVENTION.convert_parameter_name(key): value - for key, value in six.iteritems(kwargs)}) + for key, value in kwargs.items()}) def _infer_parameter_type(name, class_name): @@ -330,7 +329,7 @@ def _create_basic_mpl_stub(murano_method, reserve_params, payload, i = reserve_params + 1 varargs = False kwargs = False - for name, arg_spec in six.iteritems(murano_method.arguments_scheme): + for name, arg_spec in murano_method.arguments_scheme.items(): position = i if arg_spec.usage == dsl_types.MethodArgumentUsages.VarArgs: name = '*' @@ -396,7 +395,7 @@ def get_class_factory_definition(cls, murano_class): def filter_parameters(__fd, *args, **kwargs): if '*' not in __fd.parameters: position_args = 0 - for p in six.itervalues(__fd.parameters): + for p in __fd.parameters.values(): if p.position is not None: position_args += 1 args = args[:position_args] @@ -405,7 +404,7 @@ def filter_parameters(__fd, *args, **kwargs): if not utils.is_keyword(name): del kwargs[name] if '**' not in __fd.parameters: - names = {p.alias or p.name for p in six.itervalues(__fd.parameters)} + names = {p.alias or p.name for p in __fd.parameters.values()} for name in list(kwargs.keys()): if name not in names: del kwargs[name] diff --git a/murano/engine/mock_context_manager.py b/murano/engine/mock_context_manager.py index dd7659ec..b8f90e6d 100644 --- a/murano/engine/mock_context_manager.py +++ b/murano/engine/mock_context_manager.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import six from yaql.language import specs from yaql.language import yaqltypes @@ -91,7 +90,7 @@ def with_original(context, **kwargs): new_context = context.create_child_context() original_context = context[constants.CTX_ORIGINAL_CONTEXT] - for k, v in six.iteritems(kwargs): + for k, v in kwargs.items(): new_context['$' + k] = v(original_context) return new_context diff --git a/murano/engine/package_loader.py b/murano/engine/package_loader.py index 284fcce7..2f526c28 100644 --- a/murano/engine/package_loader.py +++ b/murano/engine/package_loader.py @@ -122,7 +122,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): def load_class_package(self, class_name, version_spec): packages = self._class_cache.get(class_name) if packages: - version = version_spec.select(six.iterkeys(packages)) + version = version_spec.select(packages.keys()) if version: return packages[version] @@ -148,7 +148,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): packages = self._package_cache.get(package_name) if packages: - version = version_spec.select(six.iterkeys(packages)) + version = version_spec.select(packages.keys()) if version: return packages[version] @@ -484,7 +484,7 @@ class DirectoryPackageLoader(package_loader.MuranoPackageLoader): packages = self._packages_by_class.get(class_name) if not packages: raise exceptions.NoPackageForClassFound(class_name) - version = version_spec.select(six.iterkeys(packages)) + version = version_spec.select(packages.keys()) if not version: raise exceptions.NoPackageForClassFound(class_name) return packages[version] @@ -497,7 +497,7 @@ class DirectoryPackageLoader(package_loader.MuranoPackageLoader): packages = self._packages_by_name.get(package_name) if not packages: raise exceptions.NoPackageFound(package_name) - version = version_spec.select(six.iterkeys(packages)) + version = version_spec.select(packages.keys()) if not version: raise exceptions.NoPackageFound(package_name) self._fixations[package_name].add(version) @@ -513,8 +513,8 @@ class DirectoryPackageLoader(package_loader.MuranoPackageLoader): @property def packages(self): - for package_versions in six.itervalues(self._packages_by_name): - for package in six.itervalues(package_versions): + for package_versions in self._packages_by_name.values(): + for package in package_versions.values(): yield package @staticmethod @@ -582,7 +582,7 @@ class CombinedPackageLoader(package_loader.MuranoPackageLoader): for loader in self.directory_loaders: fixations = deserialize_package_fixations( loader.export_fixation_table()) - for key, value in six.iteritems(fixations): + for key, value in fixations.items(): result[key].update(value) return serialize_package_fixations(result) @@ -625,7 +625,7 @@ def _with_to_generator(context_obj): def deserialize_package_fixations(fixations): result = collections.defaultdict(set) - for name, versions in six.iteritems(fixations): + for name, versions in fixations.items(): for version in versions: result[name].add(helpers.parse_version(version)) return result @@ -634,5 +634,5 @@ def deserialize_package_fixations(fixations): def serialize_package_fixations(fixations): return { name: list(str(v) for v in versions) - for name, versions in six.iteritems(fixations) + for name, versions in fixations.items() } diff --git a/murano/engine/system/heat_stack.py b/murano/engine/system/heat_stack.py index 13a798d3..4029cf68 100644 --- a/murano/engine/system/heat_stack.py +++ b/murano/engine/system/heat_stack.py @@ -21,7 +21,6 @@ import heatclient.client as hclient import heatclient.exc as heat_exc from oslo_config import cfg from oslo_log import log as logging -import six from murano.common import auth_utils from murano.dsl import dsl @@ -146,7 +145,7 @@ class HeatStack(object): @staticmethod def _remove_system_params(parameters): - return dict((k, v) for k, v in six.iteritems(parameters) if + return dict((k, v) for k, v in parameters.items() if not k.startswith('OS::')) def _get_status(self): diff --git a/murano/hacking/checks.py b/murano/hacking/checks.py index b4ddbab2..2603c246 100644 --- a/murano/hacking/checks.py +++ b/murano/hacking/checks.py @@ -54,24 +54,6 @@ def no_mutable_default_args(logical_line): yield (0, msg) -def check_python3_no_iteritems(logical_line): - if re.search(r".*\.iteritems\(\)", logical_line): - msg = ("M323: Use six.iteritems() instead of dict.iteritems().") - yield(0, msg) - - -def check_python3_no_iterkeys(logical_line): - if re.search(r".*\.iterkeys\(\)", logical_line): - msg = ("M324: Use six.iterkeys() instead of dict.iterkeys().") - yield(0, msg) - - -def check_python3_no_itervalues(logical_line): - if re.search(r".*\.itervalues\(\)", logical_line): - msg = ("M325: Use six.itervalues() instead of dict.itervalues().") - yield(0, msg) - - def check_no_basestring(logical_line): if re.search(r"\bbasestring\b", logical_line): msg = ("M326: basestring is not Python3-compatible, use " @@ -82,7 +64,4 @@ def check_no_basestring(logical_line): def factory(register): register(assert_equal_none) register(no_mutable_default_args) - register(check_python3_no_iteritems) - register(check_python3_no_iterkeys) - register(check_python3_no_itervalues) register(check_no_basestring) diff --git a/murano/packages/hot_package.py b/murano/packages/hot_package.py index 66b19317..ea3ddabe 100644 --- a/murano/packages/hot_package.py +++ b/murano/packages/hot_package.py @@ -178,7 +178,7 @@ class HotPackage(package_base.PackageBase): @staticmethod def _translate_outputs(hot): contract = {} - for key in six.iterkeys(hot.get('outputs') or {}): + for key in (hot.get('outputs') or {}).keys(): contract[key] = YAQL("$.string()") return { 'templateOutputs': { @@ -391,7 +391,7 @@ class HotPackage(package_base.PackageBase): rest_group = [] properties = [] - for key, value in six.iteritems(hot_parameters): + for key, value in hot_parameters.items(): if key not in used_parameters: rest_group.append(HotPackage._translate_ui_parameter( key, value)) diff --git a/murano/policy/modify/actions/action_manager.py b/murano/policy/modify/actions/action_manager.py index a0d189f6..b32c5cd5 100644 --- a/murano/policy/modify/actions/action_manager.py +++ b/murano/policy/modify/actions/action_manager.py @@ -15,7 +15,6 @@ from oslo_log import log as logging from oslo_utils import importutils -import six from stevedore import extension import yaml @@ -84,7 +83,7 @@ class ModifyActionManager(object): '"action-name: {{p1: v1, ...}}" ' 'but got "{action_spec}"' .format(action_spec=action_spec)) - for name, kwargs in six.iteritems(actions): + for name, kwargs in actions.items(): LOG.debug('Executing action {name}, params {params}' .format(name=name, params=kwargs)) # loads action class diff --git a/murano/tests/unit/api/cmd/test_test_runner.py b/murano/tests/unit/api/cmd/test_test_runner.py index 0399ed9a..c4b76c09 100644 --- a/murano/tests/unit/api/cmd/test_test_runner.py +++ b/murano/tests/unit/api/cmd/test_test_runner.py @@ -37,7 +37,7 @@ class TestCaseShell(testtools.TestCase): 'project_name': 'test', 'auth_url': 'http://localhost:5000'} self.args = ['test-runner.py'] - for k, v in six.iteritems(self.auth_params): + for k, v in self.auth_params.items(): k = '--os-' + k.replace('_', '-') self.args.extend([k, v]) diff --git a/murano/tests/unit/api/v1/test_catalog.py b/murano/tests/unit/api/v1/test_catalog.py index 92cb2ed5..f2b965fa 100644 --- a/murano/tests/unit/api/v1/test_catalog.py +++ b/murano/tests/unit/api/v1/test_catalog.py @@ -984,7 +984,7 @@ class TestCatalogApi(test_base.ControllerTest, test_base.MuranoApiTestCase): # pkg_to_upload into package_meta dict. pkg_to_upload = mock.MagicMock( __exit__=lambda obj, type, value, tb: False) - for k, v in six.iteritems(PKG_PARAMS_MAP): + for k, v in PKG_PARAMS_MAP.items(): if v in test_package_meta.keys(): val = test_package_meta[v] setattr(pkg_to_upload.__enter__(), k, val) diff --git a/murano/tests/unit/dsl/foundation/runner.py b/murano/tests/unit/dsl/foundation/runner.py index 18c8c0bc..f82e6374 100644 --- a/murano/tests/unit/dsl/foundation/runner.py +++ b/murano/tests/unit/dsl/foundation/runner.py @@ -40,7 +40,7 @@ class TestContextManager(context_manager.ContextManager): context = helpers.link_contexts( root_context, yaql_functions.get_context(runtime_version)) context = context.create_child_context() - for name, func in six.iteritems(self.__functions): + for name, func in self.__functions.items(): context.register_function(func, name) return context @@ -97,7 +97,7 @@ class Runner(object): if isinstance(arg, object_model.Object): arg = object_model.build_model(arg) final_args.append(arg) - for name, arg in six.iteritems(kwargs): + for name, arg in kwargs.items(): if isinstance(arg, object_model.Object): arg = object_model.build_model(arg) final_kwargs[name] = arg diff --git a/murano/tests/unit/dsl/foundation/test_package_loader.py b/murano/tests/unit/dsl/foundation/test_package_loader.py index 952eb612..a56c5772 100644 --- a/murano/tests/unit/dsl/foundation/test_package_loader.py +++ b/murano/tests/unit/dsl/foundation/test_package_loader.py @@ -14,7 +14,6 @@ import os.path -import six from murano.dsl import constants from murano.dsl import murano_package @@ -57,7 +56,7 @@ class TestPackageLoader(package_loader.MuranoPackageLoader): self._package = TestPackage( self, package_name, None, constants.RUNTIME_VERSION_1_0, None, self._configs, meta) - for name, payload in six.iteritems(self._classes): + for name, payload in self._classes.items(): self._package.register_class(payload, name) super(TestPackageLoader, self).__init__() @@ -106,8 +105,8 @@ class TestPackageLoader(package_loader.MuranoPackageLoader): if 'Name' not in data: continue - for name, method in six.iteritems(data.get('Methods') or data.get( - 'Workflow') or {}): + for name, method in (data.get('Methods') or data.get( + 'Workflow') or {}).items(): if name.startswith('test'): method['Scope'] = 'Public' diff --git a/murano/tests/unit/engine/test_mock_context_manager.py b/murano/tests/unit/engine/test_mock_context_manager.py index 3dc375aa..38e33b58 100644 --- a/murano/tests/unit/engine/test_mock_context_manager.py +++ b/murano/tests/unit/engine/test_mock_context_manager.py @@ -44,7 +44,7 @@ class TestMockContextManager(mock_context_manager.MockContextManager): root_context = super(TestMockContextManager, self).create_root_context( runtime_version) context = root_context.create_child_context() - for name, func in six.iteritems(self.__functions): + for name, func in self.__functions.items(): context.register_function(func, name) return context diff --git a/murano/tests/unit/test_hacking.py b/murano/tests/unit/test_hacking.py index acb92a9e..b5bc1106 100644 --- a/murano/tests/unit/test_hacking.py +++ b/murano/tests/unit/test_hacking.py @@ -97,27 +97,6 @@ class HackingTestCase(base.MuranoTestCase): self.assertEqual(0, len(list(checks.no_mutable_default_args( "defined, undefined = [], {}")))) - def test_check_python3_no_iteritems(self): - self.assertEqual(1, len(list(checks.check_python3_no_iteritems( - "{'foo': 'bar'}.iteritems()")))) - - self.assertEqual(0, len(list(checks.check_python3_no_iteritems( - "six.iteritems({'foo': 'bar'}")))) - - def test_check_python3_no_iterkeys(self): - self.assertEqual(1, len(list(checks.check_python3_no_iterkeys( - "{'foo': 'bar'}.iterkeys()")))) - - self.assertEqual(0, len(list(checks.check_python3_no_iterkeys( - "six.iterkeys({'foo': 'bar'}")))) - - def test_check_python3_no_itervalues(self): - self.assertEqual(1, len(list(checks.check_python3_no_itervalues( - "{'foo': 'bar'}.itervalues()")))) - - self.assertEqual(0, len(list(checks.check_python3_no_itervalues( - "six.itervalues({'foo': 'bar'}")))) - def test_check_no_basestring(self): self.assertEqual(1, len(list(checks.check_no_basestring( "isinstance('foo', basestring)")))) @@ -130,8 +109,5 @@ class HackingTestCase(base.MuranoTestCase): checks.factory(mock_register) expected = [ mock.call(checks.no_mutable_default_args), - mock.call(checks.check_python3_no_iteritems), - mock.call(checks.check_python3_no_iterkeys), - mock.call(checks.check_python3_no_itervalues), mock.call(checks.check_no_basestring)] mock_register.assert_has_calls(expected) diff --git a/murano_tempest_tests/services/artifacts/artifacts_client.py b/murano_tempest_tests/services/artifacts/artifacts_client.py index 3b3c1a1c..789497b5 100644 --- a/murano_tempest_tests/services/artifacts/artifacts_client.py +++ b/murano_tempest_tests/services/artifacts/artifacts_client.py @@ -20,7 +20,6 @@ from tempest import config from tempest.lib.common import rest_client from murano_tempest_tests import utils -import six CONF = config.CONF @@ -132,7 +131,7 @@ class ArtifactsClient(rest_client.RestClient): 'tags': manifest.get('Tags', []), 'class_definitions': package.classes.keys() } - for k, v in six.iteritems(body): + for k, v in body.items(): package_draft[k] = v inherits = utils.get_local_inheritance(package.classes) diff --git a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py b/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py index ba704ef4..3ce0320a 100644 --- a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py +++ b/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning.py @@ -13,7 +13,6 @@ # under the License. import os -import six import testtools from tempest import config @@ -60,7 +59,7 @@ class TestVersioning(base.BaseArtifactsTest): @classmethod def resource_cleanup(cls): - for pkg in six.itervalues(cls.packages): + for pkg in cls.packages.values(): cls.artifacts_client.delete_package(pkg['id']) map(os.remove, cls.abs_archive_paths) super(TestVersioning, cls).resource_cleanup() diff --git a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py b/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py index 298e3b1a..5e86b1ba 100644 --- a/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py +++ b/murano_tempest_tests/tests/api/application_catalog/artifacts/test_versioning_negative.py @@ -13,7 +13,6 @@ # under the License. import os -import six import testtools from tempest import config @@ -54,7 +53,7 @@ class TestVersioningNegative(base.BaseArtifactsTest): @classmethod def resource_cleanup(cls): - for pkg in six.itervalues(cls.packages): + for pkg in cls.packages.values(): cls.artifacts_client.delete_package(pkg['id']) map(os.remove, cls.abs_archive_paths) super(TestVersioningNegative, cls).resource_cleanup() diff --git a/murano_tempest_tests/utils.py b/murano_tempest_tests/utils.py index 40497148..79d628d2 100644 --- a/murano_tempest_tests/utils.py +++ b/murano_tempest_tests/utils.py @@ -319,8 +319,8 @@ class Package(FileWrapperMixin): def classes(self): if not hasattr(self, '_classes'): self._classes = {} - for class_name, class_file in six.iteritems( - self.manifest.get('Classes', {})): + for class_name, class_file in ( + self.manifest.get('Classes', {}).items()): filename = "Classes/%s" % class_file if filename not in self.contents.namelist(): continue @@ -431,7 +431,7 @@ class Package(FileWrapperMixin): def _get_direct_deps(package, base_url, path): result = [] if 'Require' in package.manifest: - for dep_name, ver in six.iteritems(package.manifest['Require']): + for dep_name, ver in package.manifest['Require'].items(): try: req_file = Package.from_location( dep_name, @@ -480,7 +480,7 @@ class NamespaceResolver(object): def get_local_inheritance(classes): result = {} - for class_name, klass in six.iteritems(classes): + for class_name, klass in classes.items(): if 'Extends' not in klass: continue ns = klass.get('Namespaces')