Replace dict.iteritems() with six.iteritems(dict)
This patch was generated by the sixer tool version 0.2 using the "iteritems" operation: https://pypi.python.org/pypi/sixer Manual changes: - Don't change get_instance_metadata() in nova/compute/api.py: fixed by the change Ifd455e70002eb9636b87f83788384127ba6edeeb. - Don't change sqlalchemy code and nova/tests/unit/db/test_db_api.py. sqlalchemy objects cannot be converted to a dictionary using dict(obj) directly yet. It will be possible with the change I702be362a58155a28482e733e60539d36c039509. - Revert change in a comment in nova/objects/instance.py; the sixer tool is limited and don't understand comments - Reformat nova/virt/vmwareapi/driver.py to respect the 80 columns contraint Blueprint nova-python3 Change-Id: I81465661cb8a74778d70ba9b6641073f1effa49b
This commit is contained in:
@@ -18,6 +18,7 @@ import re
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
@@ -87,11 +88,11 @@ class BlockDeviceDict(dict):
|
||||
bdm_dict['device_name'] = prepend_dev(bdm_dict['device_name'])
|
||||
# NOTE (ndipanov): Never default db fields
|
||||
self.update({field: None for field in self._fields - do_not_default})
|
||||
self.update(list(bdm_dict.iteritems()))
|
||||
self.update(list(six.iteritems(bdm_dict)))
|
||||
|
||||
def _validate(self, bdm_dict):
|
||||
"""Basic data format validations."""
|
||||
dict_fields = set(key for key, _ in bdm_dict.iteritems())
|
||||
dict_fields = set(key for key, _ in six.iteritems(bdm_dict))
|
||||
|
||||
# Check that there are no bogus fields
|
||||
if not (dict_fields <=
|
||||
@@ -137,7 +138,7 @@ class BlockDeviceDict(dict):
|
||||
non_computable_fields = set(['boot_index', 'disk_bus',
|
||||
'guest_format', 'device_type'])
|
||||
|
||||
new_bdm = {fld: val for fld, val in legacy_bdm.iteritems()
|
||||
new_bdm = {fld: val for fld, val in six.iteritems(legacy_bdm)
|
||||
if fld in copy_over_fields}
|
||||
|
||||
virt_name = legacy_bdm.get('virtual_name')
|
||||
|
||||
Reference in New Issue
Block a user