Remove None as a redundant argument to dict.get()

`dict.get()` returns `None` by default, if a key wasn't found.
Removing `None` as second argument to avoid redundancy.

Change-Id: I92fe515c0f920a324ac7dd85577d7ee25a6f20a0
This commit is contained in:
ting.wang 2016-02-17 00:06:14 +08:00
parent ba159a9ea3
commit 21b3cb445b
4 changed files with 7 additions and 7 deletions

View File

@ -36,9 +36,9 @@ class ShareManageMixin(object):
# DB layers for 'name' and 'description' API params that are
# represented in DB as 'display_name' and 'display_description'
# appropriately.
name = share_data.get('display_name', share_data.get('name', None))
name = share_data.get('display_name', share_data.get('name'))
description = share_data.get(
'display_description', share_data.get('description', None))
'display_description', share_data.get('description'))
share = {
'host': share_data['service_host'],

View File

@ -141,7 +141,7 @@ class ShareTypesController(wsgi.Controller):
share_type = body['share_type']
else:
share_type = body['volume_type']
name = share_type.get('name', None)
name = share_type.get('name')
specs = share_type.get('extra_specs', {})
is_public = share_type.get(
'os-share-type-access:is_public',

View File

@ -65,7 +65,7 @@ class FilterScheduler(base.Scheduler):
In the event that the request gets re-scheduled, this entry
will signal that the given backend has already been tried.
"""
retry = filter_properties.get('retry', None)
retry = filter_properties.get('retry')
if not retry:
return
hosts = retry['hosts']
@ -278,7 +278,7 @@ class FilterScheduler(base.Scheduler):
if not exc:
return # no exception info from a previous attempt, skip
hosts = retry.get('hosts', None)
hosts = retry.get('hosts')
if not hosts:
return # no previously attempted hosts, skip
@ -388,7 +388,7 @@ class FilterScheduler(base.Scheduler):
"""
elevated = context.elevated()
shr_types = request_spec.get("share_types", None)
shr_types = request_spec.get("share_types")
weighed_hosts = []

View File

@ -25,7 +25,7 @@ class RetryFilter(base_host.BaseHostFilter):
def host_passes(self, host_state, filter_properties):
"""Skip nodes that have already been attempted."""
retry = filter_properties.get('retry', None)
retry = filter_properties.get('retry')
if not retry:
# Re-scheduling is disabled
LOG.debug("Re-scheduling is disabled")