Replace dict.iteritems() with dict.items()

Partially-Implements: blueprint designate-py3

Change-Id: I068d05e77bd94cbe2ce613dd4428545144214786
This commit is contained in:
Pradeep Kumar Singh 2015-06-30 09:39:44 +05:30
parent 77783cb377
commit 7ef90aeccf
13 changed files with 21 additions and 21 deletions

View File

@ -53,7 +53,7 @@ class QuotasController(rest.RestController):
values = self._view.load(context, request, body)
for resource, hard_limit in values.iteritems():
for resource, hard_limit in values.items():
self.central_api.set_quota(context, tenant_id, resource,
hard_limit)

View File

@ -63,7 +63,7 @@ class Denominator(object):
return self._execute(['zone', 'delete'], kwargs)
def _params(self, **kwargs):
params = [('--%s' % k, str(v)) for k, v in kwargs.iteritems()]
params = [('--%s' % k, str(v)) for k, v in kwargs.items()]
return list(itertools.chain(*params))
def _base(self):
@ -219,7 +219,7 @@ class DenominatorBackend(base.AgentBackend):
data=data)
# Remaining records should be deleted
for name, types in subdomains.iteritems():
for name, types in subdomains.items():
for rtype in types:
self.denominator.delete_record(
zone=domain_name, id=name, type=rtype)

View File

@ -80,7 +80,7 @@ class PoolAttributeListAPIv2Adapter(base.APIv2Adapter):
@classmethod
def _parse_list(cls, values, output_object, *args, **kwargs):
for key, value in values.iteritems():
for key, value in values.items():
# Add the object to the list
output_object.append(
# Get the right Adapter

View File

@ -90,7 +90,7 @@ class ValidationErrorAPIv2Adapter(base.APIv2Adapter):
return path_segment, obj_adapter
for key, value in obj_adapter.MODIFICATIONS.get(
'fields', {}).iteritems():
'fields', {}).items():
# Check if this field as actually a nested object
if object.FIELDS.get(path_segment, {}).get('relation', False):

View File

@ -92,7 +92,7 @@ class DesignateAdapter(object):
# The dict we will return to be rendered to JSON / output format
r_obj = {}
# Loop over all fields that are supposed to be output
for key, value in cls.MODIFICATIONS['fields'].iteritems():
for key, value in cls.MODIFICATIONS['fields'].items():
# Get properties for this field
field_props = cls.MODIFICATIONS['fields'][key]
# Check if it has to be renamed
@ -156,7 +156,7 @@ class DesignateAdapter(object):
def _parse_object(cls, values, output_object, *args, **kwargs):
error_keys = []
for key, value in values.iteritems():
for key, value in values.items():
if key in cls.MODIFICATIONS['fields']:
# No rename needed
obj_key = key

View File

@ -274,7 +274,7 @@ class DesignateObject(object):
def update(self, values):
"""Update a object's fields with the supplied key/value pairs"""
for k, v in values.iteritems():
for k, v in values.items():
setattr(self, k, v)
@property
@ -430,7 +430,7 @@ class DictObjectMixin(object):
if self.obj_attr_is_set(field):
yield field, getattr(self, field)
items = lambda self: list(self.iteritems())
items = lambda self: list(self.items())
class ListObjectMixin(object):

View File

@ -412,7 +412,7 @@ class SQLAlchemy(object):
# Add all the loaded vars into RecordSet object
for key, value in rs_map.iteritems():
for key, value in rs_map.items():
setattr(current_rrset, key, record[value])
current_rrset.records = relation_list_cls()
@ -420,7 +420,7 @@ class SQLAlchemy(object):
if record[r_map['id']] is not None:
rrdata = relation_cls()
for key, value in r_map.iteritems():
for key, value in r_map.items():
setattr(rrdata, key, record[value])
current_rrset.records.append(rrdata)
@ -429,7 +429,7 @@ class SQLAlchemy(object):
# We've already got an rrset, add the rdata
if record[r_map['id']] is not None:
for key, value in r_map.iteritems():
for key, value in r_map.items():
setattr(rrdata, key, record[value])
current_rrset.records.append(rrdata)

View File

@ -36,7 +36,7 @@ def _create_facade_lazily(cfg_group, connection=None, discriminator=None):
if cache_name not in _FACADES:
_FACADES[cache_name] = session.EngineFacade(
connection,
**dict(cfg.CONF[cfg_group].iteritems()))
**dict(cfg.CONF[cfg_group].items()))
return _FACADES[cache_name]

View File

@ -360,7 +360,7 @@ class TestCase(base.BaseTestCase):
def config(self, **kwargs):
group = kwargs.pop('group', None)
for k, v in kwargs.iteritems():
for k, v in kwargs.items():
cfg.CONF.set_override(k, v, group)
def policy(self, rules, default_rule='allow', overwrite=True):

View File

@ -77,8 +77,8 @@ class CentralServiceTestIPA(designate.tests.test_central.
super(CentralServiceTestIPA, self).tearDown()
def assertRecordsEqual(self, rec1, rec2):
rec1dict = dict(rec1.iteritems())
rec2dict = dict(rec2.iteritems())
rec1dict = dict(rec1.items())
rec2dict = dict(rec2.items())
self.assertEqual(rec1dict, rec2dict)
def test_delete_recordset_extra(self):

View File

@ -271,7 +271,7 @@ def deep_dict_merge(a, b):
result = copy.deepcopy(a)
for k, v in b.iteritems():
for k, v in b.items():
if k in result and isinstance(result[k], dict):
result[k] = deep_dict_merge(result[k], v)
else:

View File

@ -79,7 +79,7 @@ class CollectionModel(BaseModel):
setattr(model, cls.COLLECTION_NAME, collection)
# deserialize data['
for key, model_type in cls.SUB_MODELS.iteritems():
for key, model_type in cls.SUB_MODELS.items():
if hasattr(model, key):
val = getattr(model, key)
setattr(model, key, model_type.from_dict(val))

View File

@ -33,9 +33,9 @@ def parameterized_class(cls):
Mark your test cases with @parameterized.
"""
test_functions = {
k: v for k, v in vars(cls).iteritems() if k.startswith('test')
k: v for k, v in vars(cls).items() if k.startswith('test')
}
for name, f in test_functions.iteritems():
for name, f in test_functions.items():
if not hasattr(f, '_test_data'):
continue
@ -43,7 +43,7 @@ def parameterized_class(cls):
delattr(cls, name)
# add a new test function to the class for each entry in f._test_data
for tag, args in f._test_data.iteritems():
for tag, args in f._test_data.items():
new_name = "{0}_{1}".format(f.__name__, tag)
if hasattr(cls, new_name):
raise Exception(