Remove redundant default value None for dict.get

The default value for dict.get is None, no need to specify again.

Change-Id: I3c894bb3449551c639094bf020277706000c3d60
This commit is contained in:
ZhiQiang Fan 2014-02-22 12:15:25 +08:00
parent 8bc043393d
commit d483b98726
5 changed files with 9 additions and 9 deletions

View File

@ -77,7 +77,7 @@ class UserAuthInfo(object):
if not user_id and not user_name:
raise exception.ValidationError(attribute='id or name',
target='user')
self.password = user_info.get('password', None)
self.password = user_info.get('password')
try:
if user_name:
if 'domain' not in user_info:

View File

@ -96,7 +96,7 @@ class XmlDeserializer(object):
prefix = None
for xmlns in XMLNS_LIST:
if xmlns['value'] == ns:
prefix = xmlns.get('prefix', None)
prefix = xmlns.get('prefix')
break
if prefix is not None:
return '%(PREFIX)s:%(tag_name)s' \
@ -209,7 +209,7 @@ class XmlSerializer(object):
root_name = m.string[m.start():]
prefix = m.string[0:m.start() - 1]
for ns in XMLNS_LIST:
if prefix == ns.get('prefix', None):
if prefix == ns.get('prefix'):
xmlns = ns['value']
break
# only the root dom element gets an xlmns

View File

@ -151,7 +151,7 @@ class RestfulTestCase(tests.TestCase):
if response.body is not None and response.body.strip():
# if a body is provided, a Content-Type is also expected
header = response.headers.get('Content-Type', None)
header = response.headers.get('Content-Type')
self.assertIn(content_type, header)
if content_type == 'json':

View File

@ -62,7 +62,7 @@ class FederatedIdentityProviderTests(FederationTests):
def _fetch_attribute_from_response(self, resp, parameter,
assert_is_not_none=True):
"""Fetch single attribute from TestResponse object."""
result = resp.result.get(parameter, None)
result = resp.result.get(parameter)
if assert_is_not_none:
self.assertIsNotNone(result)
return result

View File

@ -215,7 +215,7 @@ class Auth(controller.V2Controller):
metadata_ref['trustee_user_id'] = trust_ref['trustee_user_id']
metadata_ref['trust_id'] = trust_id
bind = old_token_ref.get('bind', None)
bind = old_token_ref.get('bind')
return (current_user_ref, tenant_ref, metadata_ref, expiry, bind)
@ -243,7 +243,7 @@ class Auth(controller.V2Controller):
attribute='username or userId',
target='passwordCredentials')
user_id = auth['passwordCredentials'].get('userId', None)
user_id = auth['passwordCredentials'].get('userId')
if user_id and len(user_id) > CONF.max_param_size:
raise exception.ValidationSizeError(attribute='userId',
size=CONF.max_param_size)
@ -323,12 +323,12 @@ class Auth(controller.V2Controller):
Returns a valid tenant_id if it exists, or None if not specified.
"""
tenant_id = auth.get('tenantId', None)
tenant_id = auth.get('tenantId')
if tenant_id and len(tenant_id) > CONF.max_param_size:
raise exception.ValidationSizeError(attribute='tenantId',
size=CONF.max_param_size)
tenant_name = auth.get('tenantName', None)
tenant_name = auth.get('tenantName')
if tenant_name and len(tenant_name) > CONF.max_param_size:
raise exception.ValidationSizeError(attribute='tenantName',
size=CONF.max_param_size)