Merge "Change dict() to {}"

This commit is contained in:
Jenkins
2015-07-08 09:40:36 +00:00
committed by Gerrit Code Review
4 changed files with 17 additions and 17 deletions

View File

@@ -193,7 +193,7 @@ def get_configuration():
"""
server = objects.Server()
logical_drives = server.get_logical_drives()
raid_config = dict()
raid_config = {}
raid_config['logical_disks'] = []
for logical_drive in logical_drives:

View File

@@ -58,7 +58,7 @@ def _get_key_value(string):
def _get_dict(lines, start_index, indentation):
"""Recursive function for parsing hpssacli output."""
info = dict()
info = {}
current_item = None
i = start_index
@@ -69,7 +69,7 @@ def _get_dict(lines, start_index, indentation):
if current_line_indentation == indentation:
current_item = current_line.lstrip(' ')
info[current_item] = dict()
info[current_item] = {}
i = i + 1
continue
@@ -312,7 +312,7 @@ class Controller(object):
self.unassigned_physical_drives = []
self.raid_arrays = []
unassigned_drives = properties.get('unassigned', dict())
unassigned_drives = properties.get('unassigned', {})
for key, value in unassigned_drives.items():
self.unassigned_physical_drives.append(PhysicalDrive(key,
value,

View File

@@ -199,7 +199,7 @@ class RIBCLOperations(operations.IloOperations):
Converts the actual response from the ILO for an API
to the dictionary.
"""
node = dict()
node = {}
text = getattr(element, 'text')
if text is not None:
text = text.strip()

View File

@@ -62,7 +62,7 @@ class RISOperations(operations.IloOperations):
start_url = url.geturl()
if request_headers is None:
request_headers = dict()
request_headers = {}
# Use self.login/self.password and Basic Auth
if self.login is not None and self.password is not None:
@@ -141,7 +141,7 @@ class RISOperations(operations.IloOperations):
HTTP response codes could be 500, 404, 202 etc.
"""
if not isinstance(request_headers, dict):
request_headers = dict()
request_headers = {}
request_headers['Content-Type'] = 'application/json'
return self._rest_op('PATCH', suburi, request_headers, request_body)
@@ -151,7 +151,7 @@ class RISOperations(operations.IloOperations):
HTTP response codes could be 500, 404, 202 etc.
"""
if not isinstance(request_headers, dict):
request_headers = dict()
request_headers = {}
request_headers['Content-Type'] = 'application/json'
return self._rest_op('PUT', suburi, request_headers, request_body)
@@ -162,7 +162,7 @@ class RISOperations(operations.IloOperations):
ExtendedError, or it could be empty.
"""
if not isinstance(request_headers, dict):
request_headers = dict()
request_headers = {}
request_headers['Content-Type'] = 'application/json'
return self._rest_op('POST', suburi, request_headers, request_body)
@@ -370,7 +370,7 @@ class RISOperations(operations.IloOperations):
def _get_bios_hash_password(self, bios_password):
"""Get the hashed BIOS password."""
request_headers = dict()
request_headers = {}
if bios_password:
bios_password_hash = hashlib.sha256((bios_password.encode()).
hexdigest().upper())
@@ -557,7 +557,7 @@ class RISOperations(operations.IloOperations):
secure_boot_uri = system['Oem']['Hp']['links']['SecureBoot']['href']
# Change the property required
new_secure_boot_settings = dict()
new_secure_boot_settings = {}
new_secure_boot_settings[property] = value
# perform the patch
@@ -713,7 +713,7 @@ class RISOperations(operations.IloOperations):
in the bios boot mode.
"""
if(self._validate_uefi_boot_mode() is True):
iscsi_info = dict()
iscsi_info = {}
iscsi_info['iSCSITargetName'] = target_name
iscsi_info['iSCSIBootLUN'] = lun
iscsi_info['iSCSITargetIpAddress'] = ip_address
@@ -940,7 +940,7 @@ class RISOperations(operations.IloOperations):
msg = ('"LicenseService" section in Manager/Oem/Hp does not exist')
raise exception.IloCommandNotSupportedError(msg)
lic_key = dict()
lic_key = {}
lic_key['LicenseKey'] = key
# Perform POST to activate license
@@ -1008,7 +1008,7 @@ class RISOperations(operations.IloOperations):
# BOOT_OPTION = BOOT_ALWAYS | BOOT_ONCE | NO_BOOT
# WRITE_PROTECT = YES | NO
# IMAGE_INSERTED = YES | NO
response_data = dict()
response_data = {}
if response.get('WriteProtected', False):
response_data['WRITE_PROTECT'] = 'YES'
@@ -1074,7 +1074,7 @@ class RISOperations(operations.IloOperations):
response, vm_device_uri = self._get_vm_device_status(device)
# Update required property
vm_settings = dict()
vm_settings = {}
vm_settings['Oem'] = (
{'Hp': {'BootOnNextServerReset': boot_option_map[boot_option]}})
@@ -1104,7 +1104,7 @@ class RISOperations(operations.IloOperations):
self.eject_virtual_media(device)
# Update required property
vm_settings = dict()
vm_settings = {}
vm_settings['Image'] = url
# Perform the patch operation
@@ -1130,7 +1130,7 @@ class RISOperations(operations.IloOperations):
return
# Update required property
vm_settings = dict()
vm_settings = {}
vm_settings['Image'] = None
# perform the patch operation