Merge "Python3: Replace dict.iteritems with six.iteritems"
This commit is contained in:
commit
f350a6cf7f
@ -7,3 +7,4 @@ Murano Specific Commandments
|
||||
---------------------------
|
||||
|
||||
- [M322] Method's default argument shouldn't be mutable.
|
||||
- [M323] Python 3: do not use dict.iteritems.
|
||||
|
@ -13,6 +13,8 @@
|
||||
import os
|
||||
import yaml
|
||||
|
||||
import six
|
||||
|
||||
from murano.packages import exceptions
|
||||
from murano.packages import package_base
|
||||
|
||||
@ -85,7 +87,7 @@ class CloudifyToscaPackage(package_base.PackageBase):
|
||||
@staticmethod
|
||||
def _generate_properties(inputs, outputs):
|
||||
contracts = {}
|
||||
for name, value in inputs.iteritems():
|
||||
for name, value in six.iteritems(inputs):
|
||||
prop = {
|
||||
'Contract': YAQL('$.string().notNull()'),
|
||||
'Usage': 'In'
|
||||
@ -161,7 +163,7 @@ class CloudifyToscaPackage(package_base.PackageBase):
|
||||
'type': 'string',
|
||||
'required': True,
|
||||
'description': value.get('description', key)
|
||||
} for key, value in inputs.iteritems()
|
||||
} for key, value in six.iteritems(inputs)
|
||||
]
|
||||
return [{
|
||||
'appConfiguration': {
|
||||
|
@ -22,6 +22,7 @@ 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
|
||||
@ -235,7 +236,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 PKG_PARAMS_MAP.iteritems():
|
||||
for k, v in six.iteritems(PKG_PARAMS_MAP):
|
||||
if hasattr(pkg_to_upload, k):
|
||||
package_meta[v] = getattr(pkg_to_upload, k)
|
||||
try:
|
||||
|
@ -150,7 +150,7 @@ class Controller(object):
|
||||
params = [parameters]
|
||||
while params:
|
||||
a = params.pop()
|
||||
for k, v in a.iteritems():
|
||||
for k, v in six.iteritems(a):
|
||||
if isinstance(v, dict):
|
||||
params.append(v)
|
||||
if k == '?':
|
||||
|
@ -24,6 +24,7 @@ from oslo_config import cfg
|
||||
from oslo_db import options
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
from murano import version
|
||||
from murano.common.i18n import _, _LE
|
||||
@ -98,7 +99,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 class_to_methods.iteritems():
|
||||
for class_name, methods in six.iteritems(class_to_methods):
|
||||
methods_to_run[class_name] = []
|
||||
if item in methods:
|
||||
methods_to_run[class_name].append(item)
|
||||
@ -119,7 +120,7 @@ class MuranoTestRunner(object):
|
||||
continue
|
||||
methods_count = sum(len(v) for v in methods_to_run.itervalues())
|
||||
methods = [k + '.' + method
|
||||
for k, v in methods_to_run.iteritems() for method in v]
|
||||
for k, v in six.iteritems(methods_to_run) 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
|
||||
@ -177,7 +178,7 @@ class MuranoTestRunner(object):
|
||||
# Load keystone configuration parameters from config
|
||||
importutils.import_module('keystonemiddleware.auth_token')
|
||||
|
||||
for param, value in ks_opts.iteritems():
|
||||
for param, value in six.iteritems(ks_opts):
|
||||
if not value:
|
||||
ks_opts[param] = getattr(CONF.keystone_authtoken,
|
||||
ks_opts_to_config[param])
|
||||
@ -227,7 +228,7 @@ class MuranoTestRunner(object):
|
||||
LOG.error(msg)
|
||||
self.error(msg)
|
||||
|
||||
for pkg_class, test_cases in run_set.iteritems():
|
||||
for pkg_class, test_cases in six.iteritems(run_set):
|
||||
for m in test_cases:
|
||||
# Create new executor for each test case to provide
|
||||
# pure test environment
|
||||
|
@ -13,6 +13,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class TokenSanitizer(object):
|
||||
"""Helper class for cleaning some object from different passwords/tokens.
|
||||
@ -50,7 +52,7 @@ class TokenSanitizer(object):
|
||||
:return: Sanitized object
|
||||
"""
|
||||
if isinstance(obj, dict):
|
||||
return dict([self.sanitize(item) for item in obj.iteritems()])
|
||||
return dict([self.sanitize(item) for item in six.iteritems(obj)])
|
||||
elif isinstance(obj, list):
|
||||
return [self.sanitize(item) for item in obj]
|
||||
elif isinstance(obj, tuple):
|
||||
|
@ -214,7 +214,7 @@ class Debug(Middleware):
|
||||
resp = req.get_response(self.application)
|
||||
|
||||
print(("*" * 40) + " RESPONSE HEADERS")
|
||||
for (key, value) in resp.headers.iteritems():
|
||||
for (key, value) in six.iteritems(resp.headers):
|
||||
print(key, "=", value)
|
||||
print("")
|
||||
|
||||
@ -477,7 +477,7 @@ class Resource(object):
|
||||
"X-User-Id",
|
||||
"X-Tenant-Id")
|
||||
|
||||
for header, value in headers.iteritems():
|
||||
for header, value in six.iteritems(headers):
|
||||
if header.startswith("X-") and header not in useful_headers:
|
||||
continue
|
||||
string_parts.append("{0}: {1}".format(header, value))
|
||||
@ -1039,7 +1039,7 @@ class FormDataDeserializer(TextDeserializer):
|
||||
|
||||
def default(self, request):
|
||||
form_data_parts = request.POST
|
||||
for key, value in form_data_parts.iteritems():
|
||||
for key, value in six.iteritems(form_data_parts):
|
||||
if isinstance(value, basestring):
|
||||
form_data_parts[key] = self._from_json(value)
|
||||
return {'body': form_data_parts}
|
||||
|
@ -16,6 +16,7 @@ from oslo_config import cfg
|
||||
from oslo_db import api as oslo_db_api
|
||||
from oslo_db.sqlalchemy import utils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy.orm import attributes
|
||||
@ -377,7 +378,7 @@ def package_upload(values, tenant_id):
|
||||
_check_for_public_packages_with_fqn(
|
||||
session,
|
||||
values.get('fully_qualified_name'))
|
||||
for attr, func in composite_attr_to_func.iteritems():
|
||||
for attr, func in six.iteritems(composite_attr_to_func):
|
||||
if values.get(attr):
|
||||
result = func(values[attr], session)
|
||||
setattr(package, attr, result)
|
||||
|
@ -17,6 +17,7 @@ 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
|
||||
@ -46,7 +47,7 @@ class TimestampMixin(object):
|
||||
class _MuranoBase(models.ModelBase):
|
||||
def to_dict(self):
|
||||
dictionary = self.__dict__.copy()
|
||||
return dict((k, v) for k, v in dictionary.iteritems()
|
||||
return dict((k, v) for k, v in six.iteritems(dictionary)
|
||||
if k != '_sa_instance_state')
|
||||
|
||||
|
||||
|
@ -249,7 +249,7 @@ class EnvironmentServices(object):
|
||||
if isinstance(data.get('?'), dict):
|
||||
data['?']['id'] = uuidutils.generate_uuid()
|
||||
result = {}
|
||||
for key, value in data.iteritems():
|
||||
for key, value in six.iteritems(data):
|
||||
result[key] = EnvironmentServices._objectify(
|
||||
value, replacements)
|
||||
return result
|
||||
@ -257,7 +257,7 @@ class EnvironmentServices(object):
|
||||
return [EnvironmentServices._objectify(v, replacements)
|
||||
for v in data]
|
||||
elif isinstance(data, six.string_types):
|
||||
for key, value in replacements.iteritems():
|
||||
for key, value in six.iteritems(replacements):
|
||||
data = data.replace('%' + key + '%', value)
|
||||
return data
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from murano.dsl import dsl_types
|
||||
|
||||
|
||||
@ -37,7 +39,7 @@ class AttributeStore(object):
|
||||
return [
|
||||
[key[0], key[1], key[2], value]
|
||||
for key, value
|
||||
in self._attributes.iteritems()
|
||||
in six.iteritems(self._attributes)
|
||||
if key[0] in known_objects
|
||||
]
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
import inspect
|
||||
import os.path
|
||||
|
||||
import six
|
||||
from yaql.language import exceptions as yaql_exc
|
||||
from yaql.language import expressions as yaql_expressions
|
||||
from yaql.language import utils
|
||||
@ -240,7 +241,7 @@ class YaqlInterface(object):
|
||||
context = self.context
|
||||
args = tuple(helpers.evaluate(arg, context) for arg in args)
|
||||
kwargs = dict((key, helpers.evaluate(value, context))
|
||||
for key, value in kwargs.iteritems())
|
||||
for key, value in six.iteritems(kwargs))
|
||||
return to_mutable(
|
||||
context(item, self.engine, self.sender)(*args, **kwargs),
|
||||
self.engine)
|
||||
@ -250,7 +251,7 @@ class YaqlInterface(object):
|
||||
context = helpers.get_context().create_child_context()
|
||||
for i, param in enumerate(args):
|
||||
context['$' + str(i + 1)] = helpers.evaluate(param, context)
|
||||
for arg_name, arg_value in kwargs.iteritems():
|
||||
for arg_name, arg_value in six.iteritems(kwargs):
|
||||
context['$' + arg_name] = helpers.evaluate(arg_value, context)
|
||||
parsed = self.engine(__expression)
|
||||
res = parsed.evaluate(context=context)
|
||||
|
@ -94,7 +94,7 @@ class MuranoDslExecutor(object):
|
||||
with self._acquire_method_lock(method, this):
|
||||
for i, arg in enumerate(args, 2):
|
||||
context[str(i)] = arg
|
||||
for key, value in kwargs.iteritems():
|
||||
for key, value in six.iteritems(kwargs):
|
||||
context[key] = value
|
||||
|
||||
def call():
|
||||
@ -147,7 +147,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 kwargs.iteritems()))
|
||||
for name, value in six.iteritems(kwargs)))
|
||||
params_str = u', '.join(param_gen)
|
||||
method_name = '{0}::{1}'.format(method.murano_class.name, method.name)
|
||||
thread_id = helpers.get_current_thread_id()
|
||||
|
@ -13,6 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import six
|
||||
|
||||
from murano.dsl import dsl_exception
|
||||
from murano.dsl import helpers
|
||||
from murano.dsl import lhs_expression
|
||||
@ -82,7 +84,7 @@ def parse_expression(expr):
|
||||
result = Statement(expr)
|
||||
elif isinstance(expr, dict):
|
||||
kwds = {}
|
||||
for key, value in expr.iteritems():
|
||||
for key, value in six.iteritems(expr):
|
||||
if isinstance(key, yaql_expression.YaqlExpression):
|
||||
if result is not None:
|
||||
raise ValueError()
|
||||
|
@ -23,6 +23,7 @@ import uuid
|
||||
import eventlet.greenpool
|
||||
import eventlet.greenthread
|
||||
import semantic_version
|
||||
import six
|
||||
import yaql.language.exceptions
|
||||
import yaql.language.expressions
|
||||
from yaql.language import utils as yaqlutils
|
||||
@ -46,7 +47,7 @@ def evaluate(value, context):
|
||||
return yaqlutils.FrozenDict(
|
||||
(evaluate(d_key, context),
|
||||
evaluate(d_value, context))
|
||||
for d_key, d_value in value.iteritems())
|
||||
for d_key, d_value in six.iteritems(value))
|
||||
elif yaqlutils.is_sequence(value):
|
||||
return tuple(evaluate(t, context) for t in value)
|
||||
elif isinstance(value, yaqlutils.SetType):
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import itertools
|
||||
|
||||
import six
|
||||
from yaql.language import specs
|
||||
from yaql.language import utils
|
||||
from yaql.language import yaqltypes
|
||||
@ -63,7 +64,7 @@ class LhsExpression(object):
|
||||
src_property.set(
|
||||
utils.FrozenDict(
|
||||
itertools.chain(
|
||||
src.iteritems(),
|
||||
six.iteritems(src),
|
||||
((key, value),))))
|
||||
elif isinstance(src, dsl_types.MuranoObject):
|
||||
src.set_property(key, value, root_context)
|
||||
|
@ -13,6 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import six
|
||||
|
||||
from murano.dsl import constants
|
||||
from murano.dsl import dsl_exception
|
||||
from murano.dsl import exceptions
|
||||
@ -188,7 +190,7 @@ class MatchMacro(expressions.DslExpression):
|
||||
|
||||
def execute(self, context):
|
||||
match_value = helpers.evaluate(self._value, context)
|
||||
for key, value in self._switch.iteritems():
|
||||
for key, value in six.iteritems(self._switch):
|
||||
if key == match_value:
|
||||
CodeBlock(value).execute(context)
|
||||
return
|
||||
@ -206,7 +208,7 @@ class SwitchMacro(expressions.DslExpression):
|
||||
|
||||
def execute(self, context):
|
||||
matched = False
|
||||
for key, value in self._switch.iteritems():
|
||||
for key, value in six.iteritems(self._switch):
|
||||
if helpers.evaluate(key, context):
|
||||
matched = True
|
||||
CodeBlock(value).execute(context)
|
||||
|
@ -16,6 +16,7 @@ import collections
|
||||
import weakref
|
||||
|
||||
import semantic_version
|
||||
import six
|
||||
from yaql.language import utils
|
||||
|
||||
from murano.dsl import constants
|
||||
@ -66,7 +67,7 @@ class MuranoClass(dsl_types.MuranoClass):
|
||||
type_obj = cls(ns_resolver, name, package, parent_classes)
|
||||
|
||||
properties = data.get('Properties') or {}
|
||||
for property_name, property_spec in properties.iteritems():
|
||||
for property_name, property_spec in six.iteritems(properties):
|
||||
spec = typespec.PropertySpec(
|
||||
property_name, property_spec, type_obj)
|
||||
type_obj.add_property(property_name, spec)
|
||||
@ -78,7 +79,7 @@ class MuranoClass(dsl_types.MuranoClass):
|
||||
'destroy': '.destroy'
|
||||
}
|
||||
|
||||
for method_name, payload in methods.iteritems():
|
||||
for method_name, payload in six.iteritems(methods):
|
||||
type_obj.add_method(
|
||||
method_mappings.get(method_name, method_name), payload)
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
import collections
|
||||
import weakref
|
||||
|
||||
import six
|
||||
from yaql.language import specs
|
||||
|
||||
from murano.dsl import dsl
|
||||
@ -60,7 +61,7 @@ class MuranoMethod(dsl_types.MuranoMethod):
|
||||
arguments_scheme = payload.get('Arguments') or []
|
||||
if isinstance(arguments_scheme, dict):
|
||||
arguments_scheme = [{key: value} for key, value in
|
||||
arguments_scheme.iteritems()]
|
||||
six.iteritems(arguments_scheme)]
|
||||
self._arguments_scheme = collections.OrderedDict()
|
||||
for record in arguments_scheme:
|
||||
if (not isinstance(record, dict) or
|
||||
|
@ -16,6 +16,7 @@ import inspect
|
||||
import weakref
|
||||
|
||||
import semantic_version
|
||||
import six
|
||||
|
||||
from murano.dsl import constants
|
||||
from murano.dsl import dsl_types
|
||||
@ -44,7 +45,7 @@ class MuranoPackage(dsl_types.MuranoPackage):
|
||||
semantic_version.Spec('==0')
|
||||
self._classes = {}
|
||||
self._imported_types = {object, murano_object.MuranoObject}
|
||||
for key, value in (requirements or {}).iteritems():
|
||||
for key, value in six.iteritems(requirements or {}):
|
||||
self._requirements[key] = helpers.parse_version_spec(value)
|
||||
|
||||
self._load_queue = {}
|
||||
@ -145,7 +146,8 @@ class MuranoPackage(dsl_types.MuranoPackage):
|
||||
return result
|
||||
if search_requirements:
|
||||
pkgs_for_search = []
|
||||
for package_name, version_spec in self._requirements.iteritems():
|
||||
for package_name, version_spec in six.iteritems(
|
||||
self._requirements):
|
||||
if package_name == self.name:
|
||||
continue
|
||||
referenced_package = self._package_loader.load_package(
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import weakref
|
||||
|
||||
import six
|
||||
|
||||
from murano.dsl import dsl_types
|
||||
from murano.dsl import helpers
|
||||
@ -103,7 +104,7 @@ class ObjectStore(object):
|
||||
|
||||
@staticmethod
|
||||
def _get_designer_attributes(header):
|
||||
return dict((k, v) for k, v in header.iteritems()
|
||||
return dict((k, v) for k, v in six.iteritems(header)
|
||||
if str(k).startswith('_'))
|
||||
|
||||
def designer_attributes(self, object_id):
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import six
|
||||
from yaql import utils
|
||||
|
||||
from murano.dsl import dsl
|
||||
@ -110,7 +111,7 @@ def _pass12_serialize(value, parent, serialized_objects,
|
||||
result = {}
|
||||
need_another_pass = False
|
||||
|
||||
for d_key, d_value in value.iteritems():
|
||||
for d_key, d_value in six.iteritems(value):
|
||||
result_key = str(d_key)
|
||||
result_value = _pass12_serialize(
|
||||
d_value, parent, serialized_objects,
|
||||
|
@ -219,7 +219,7 @@ class TypeScheme(object):
|
||||
return data
|
||||
result = {}
|
||||
yaql_key = None
|
||||
for key, value in spec.iteritems():
|
||||
for key, value in six.iteritems(spec):
|
||||
if isinstance(key, dsl_types.YaqlExpression):
|
||||
if yaql_key is not None:
|
||||
raise exceptions.DslContractSyntaxError(
|
||||
@ -234,7 +234,7 @@ class TypeScheme(object):
|
||||
|
||||
if yaql_key is not None:
|
||||
yaql_value = spec[yaql_key]
|
||||
for key, value in data.iteritems():
|
||||
for key, value in six.iteritems(data):
|
||||
if key in result:
|
||||
continue
|
||||
key = self._map(key, yaql_key, context, path)
|
||||
|
@ -15,6 +15,7 @@
|
||||
import itertools
|
||||
|
||||
import eventlet
|
||||
import six
|
||||
from yaql.language import specs
|
||||
from yaql.language import utils
|
||||
from yaql.language import yaqltypes
|
||||
@ -48,7 +49,7 @@ def new(__context, __type_name, __owner=None, __object_name=None, __extra=None,
|
||||
**parameters):
|
||||
object_store = helpers.get_object_store(__context)
|
||||
new_context = __context.create_child_context()
|
||||
for key, value in parameters.iteritems():
|
||||
for key, value in six.iteritems(parameters):
|
||||
if helpers.is_keyword(key):
|
||||
new_context[key] = value
|
||||
return __type_name.murano_class.new(
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import inspect
|
||||
|
||||
import six
|
||||
import yaql
|
||||
from yaql.language import contexts
|
||||
from yaql.language import conventions
|
||||
@ -116,7 +117,7 @@ def call_func(__context, __name, *args, **kwargs):
|
||||
return __context(__name, engine)(
|
||||
*args,
|
||||
**{CONVENTION.convert_parameter_name(key): value
|
||||
for key, value in kwargs.iteritems()})
|
||||
for key, value in six.iteritems(kwargs)})
|
||||
|
||||
|
||||
def _infer_parameter_type(name, class_name):
|
||||
@ -201,7 +202,7 @@ def _build_mpl_wrapper_function_definition(murano_method):
|
||||
murano_method.name, payload, is_function=False, is_method=True)
|
||||
|
||||
for i, (name, arg_spec) in enumerate(
|
||||
murano_method.arguments_scheme.iteritems(), 2):
|
||||
six.iteritems(murano_method.arguments_scheme), 2):
|
||||
p = specs.ParameterDefinition(
|
||||
name, ContractedValue(arg_spec),
|
||||
position=i, default=dsl.NO_VALUE)
|
||||
|
@ -13,6 +13,7 @@
|
||||
# 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
|
||||
|
||||
@ -92,7 +93,7 @@ def with_original(context, **kwargs):
|
||||
new_context = context.create_child_context()
|
||||
|
||||
original_context = context[constants.CTX_ORIGINAL_CONTEXT]
|
||||
for k, v in kwargs.iteritems():
|
||||
for k, v in six.iteritems(kwargs):
|
||||
new_context['$' + k] = v(original_context)
|
||||
return new_context
|
||||
|
||||
|
@ -19,6 +19,7 @@ import eventlet
|
||||
import heatclient.exc as heat_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from murano.common.i18n import _LW
|
||||
from murano.common import utils
|
||||
@ -109,7 +110,7 @@ class HeatStack(object):
|
||||
|
||||
@staticmethod
|
||||
def _remove_system_params(parameters):
|
||||
return dict((k, v) for k, v in parameters.iteritems() if
|
||||
return dict((k, v) for k, v in six.iteritems(parameters) if
|
||||
not k.startswith('OS::'))
|
||||
|
||||
def _get_status(self):
|
||||
|
@ -67,7 +67,7 @@ def bind(obj, mappings):
|
||||
return [bind(t, mappings) for t in obj]
|
||||
elif isinstance(obj, collections.Mapping):
|
||||
result = {}
|
||||
for key, value in obj.iteritems():
|
||||
for key, value in six.iteritems(obj):
|
||||
result[bind(key, mappings)] = bind(value, mappings)
|
||||
return result
|
||||
elif isinstance(obj, basestring) and obj.startswith('$'):
|
||||
|
@ -37,5 +37,12 @@ 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 = ("M322: Use six.iteritems() instead of dict.iteritems().")
|
||||
yield(0, msg)
|
||||
|
||||
|
||||
def factory(register):
|
||||
register(no_mutable_default_args)
|
||||
register(check_python3_no_iteritems)
|
||||
|
@ -16,6 +16,7 @@ import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from murano.packages import exceptions
|
||||
@ -387,7 +388,7 @@ class HotPackage(package_base.PackageBase):
|
||||
|
||||
rest_group = []
|
||||
properties = []
|
||||
for key, value in hot_parameters.iteritems():
|
||||
for key, value in six.iteritems(hot_parameters):
|
||||
if key not in used_parameters:
|
||||
rest_group.append(HotPackage._translate_ui_parameter(
|
||||
key, value))
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import semantic_version
|
||||
import six
|
||||
|
||||
from murano.dsl import helpers
|
||||
|
||||
@ -99,7 +100,7 @@ class CongressRulesManager(object):
|
||||
for v in obj:
|
||||
self._walk(v, new_owner, path)
|
||||
elif isinstance(obj, dict):
|
||||
for key, value in obj.iteritems():
|
||||
for key, value in six.iteritems(obj):
|
||||
self._walk(value, new_owner, path + (key, ))
|
||||
|
||||
def _process_item(self, obj, owner_id, path):
|
||||
@ -151,7 +152,7 @@ class CongressRulesManager(object):
|
||||
prefix.split('.')[0]))
|
||||
return rules
|
||||
|
||||
for key, value in obj.iteritems():
|
||||
for key, value in six.iteritems(obj):
|
||||
if key == '?':
|
||||
continue
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from oslo_log import log as logging
|
||||
@ -84,7 +85,7 @@ class ModifyActionManager(object):
|
||||
'"action-name: {{p1: v1, ...}}" '
|
||||
'but got "{action_spec}"'
|
||||
.format(action_spec=action_spec))
|
||||
for name, kwargs in actions.iteritems():
|
||||
for name, kwargs in six.iteritems(actions):
|
||||
LOG.debug('Executing action {name}, params {params}'
|
||||
.format(name=name, params=kwargs))
|
||||
# loads action class
|
||||
|
@ -18,6 +18,7 @@ Default actions reside in this module.
|
||||
These action are available out of the box for Murano users.
|
||||
|
||||
"""
|
||||
import six
|
||||
import yaql.language.utils as utils
|
||||
|
||||
import murano.dsl.exceptions as exceptions
|
||||
@ -41,7 +42,7 @@ class ActionUtils(object):
|
||||
for item in obj:
|
||||
self._get_objects_by_id(item, objects)
|
||||
elif isinstance(obj, utils.FrozenDict):
|
||||
for k, v in obj.iteritems():
|
||||
for k, v in six.iteritems(obj):
|
||||
self._get_objects_by_id(k, objects)
|
||||
self._get_objects_by_id(v, objects)
|
||||
return objects
|
||||
|
@ -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 self.auth_params.iteritems():
|
||||
for k, v in six.iteritems(self.auth_params):
|
||||
k = '--os-' + k.replace('_', '-')
|
||||
self.args.extend([k, v])
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
from murano.dsl import context_manager
|
||||
from murano.dsl import dsl
|
||||
from murano.dsl import dsl_exception
|
||||
@ -38,7 +40,7 @@ class TestContextManager(context_manager.ContextManager):
|
||||
context = linked_context.link(
|
||||
root_context, yaql_functions.get_context(runtime_version))
|
||||
context = context.create_child_context()
|
||||
for name, func in self.__functions.iteritems():
|
||||
for name, func in six.iteritems(self.__functions):
|
||||
context.register_function(func, name)
|
||||
return context
|
||||
|
||||
@ -87,7 +89,7 @@ class Runner(object):
|
||||
if isinstance(arg, object_model.Object):
|
||||
arg = object_model.build_model(arg)
|
||||
final_args.append(arg)
|
||||
for name, arg in kwargs.iteritems():
|
||||
for name, arg in six.iteritems(kwargs):
|
||||
if isinstance(arg, object_model.Object):
|
||||
arg = object_model.build_model(arg)
|
||||
final_kwargs[name] = arg
|
||||
|
@ -15,6 +15,8 @@
|
||||
import fnmatch
|
||||
import os.path
|
||||
|
||||
import six
|
||||
|
||||
from murano.dsl import murano_package
|
||||
from murano.dsl import namespace_resolver
|
||||
from murano.dsl import package_loader
|
||||
@ -53,7 +55,7 @@ class TestPackageLoader(package_loader.MuranoPackageLoader):
|
||||
self._configs = {}
|
||||
self._package = TestPackage(
|
||||
self, package_name, None, '1.0', None, self._configs)
|
||||
for name, payload in self._classes.iteritems():
|
||||
for name, payload in six.iteritems(self._classes):
|
||||
self._package.register_class(payload, name)
|
||||
super(TestPackageLoader, self).__init__()
|
||||
|
||||
@ -87,8 +89,8 @@ class TestPackageLoader(package_loader.MuranoPackageLoader):
|
||||
if 'Name' not in data:
|
||||
return
|
||||
|
||||
for name, method in (data.get('Methods') or data.get(
|
||||
'Workflow') or {}).iteritems():
|
||||
for name, method in six.iteritems(data.get('Methods') or data.get(
|
||||
'Workflow') or {}):
|
||||
if name.startswith('test'):
|
||||
method['Usage'] = 'Action'
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
from yaql import contexts
|
||||
from yaql import specs
|
||||
|
||||
@ -43,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 self.__functions.iteritems():
|
||||
for name, func in six.iteritems(self.__functions):
|
||||
context.register_function(func, name)
|
||||
return context
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user