summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhang-jinnan <ben.os@99cloud.net>2014-02-19 21:02:11 +0800
committerzhang-jinnan <ben.os@99cloud.net>2014-02-19 21:02:11 +0800
commitca721d6e9b5013093e4324899b4f69e83aeb43d3 (patch)
tree3686f4b6e942dec03ae915953bb565f0545194fc
parent7cf73f19423f53a7eddc221fddbd60a610aa47a7 (diff)
downloadpython-novaclient-ca721d6e9b5013093e4324899b4f69e83aeb43d3.tar.gz
Remove None for dict.get()
Because If no default value is specified it defaults to None already. Change-Id: I3caad9f17840347e30465c7bd4c9c4fe53d991e3
-rw-r--r--novaclient/exceptions.py4
-rw-r--r--novaclient/openstack/common/apiclient/exceptions.py4
-rw-r--r--novaclient/openstack/common/cliutils.py2
-rw-r--r--novaclient/tests/utils.py6
-rw-r--r--novaclient/tests/v1_1/fakes.py2
-rw-r--r--novaclient/v1_1/flavor_access.py4
6 files changed, 11 insertions, 11 deletions
diff --git a/novaclient/exceptions.py b/novaclient/exceptions.py
index 73049cda..9f22a9e3 100644
--- a/novaclient/exceptions.py
+++ b/novaclient/exceptions.py
@@ -222,8 +222,8 @@ def from_response(response, body, url, method=None):
if hasattr(body, 'keys'):
error = body[list(body)[0]]
- message = error.get('message', None)
- details = error.get('details', None)
+ message = error.get('message')
+ details = error.get('details')
kwargs['message'] = message
kwargs['details'] = details
diff --git a/novaclient/openstack/common/apiclient/exceptions.py b/novaclient/openstack/common/apiclient/exceptions.py
index b364d60d..45a70e0a 100644
--- a/novaclient/openstack/common/apiclient/exceptions.py
+++ b/novaclient/openstack/common/apiclient/exceptions.py
@@ -422,8 +422,8 @@ def from_response(response, method, url):
else:
if hasattr(body, "keys"):
error = body[body.keys()[0]]
- kwargs["message"] = error.get("message", None)
- kwargs["details"] = error.get("details", None)
+ kwargs["message"] = error.get("message")
+ kwargs["details"] = error.get("details")
elif content_type.startswith("text/"):
kwargs["details"] = response.text
diff --git a/novaclient/openstack/common/cliutils.py b/novaclient/openstack/common/cliutils.py
index 90715988..710f8f8f 100644
--- a/novaclient/openstack/common/cliutils.py
+++ b/novaclient/openstack/common/cliutils.py
@@ -84,7 +84,7 @@ def env(*args, **kwargs):
If all are empty, defaults to '' or keyword arg `default`.
"""
for arg in args:
- value = os.environ.get(arg, None)
+ value = os.environ.get(arg)
if value:
return value
return kwargs.get('default', '')
diff --git a/novaclient/tests/utils.py b/novaclient/tests/utils.py
index 982b953a..11bfa827 100644
--- a/novaclient/tests/utils.py
+++ b/novaclient/tests/utils.py
@@ -45,10 +45,10 @@ class TestResponse(requests.Response):
super(TestResponse, self).__init__()
self._text = None
if isinstance(data, dict):
- self.status_code = data.get('status_code', None)
- self.headers = data.get('headers', None)
+ self.status_code = data.get('status_code')
+ self.headers = data.get('headers')
# Fake the text attribute to streamline Response creation
- self._text = data.get('text', None)
+ self._text = data.get('text')
else:
self.status_code = data
diff --git a/novaclient/tests/v1_1/fakes.py b/novaclient/tests/v1_1/fakes.py
index 983f849a..3604312b 100644
--- a/novaclient/tests/v1_1/fakes.py
+++ b/novaclient/tests/v1_1/fakes.py
@@ -79,7 +79,7 @@ class FakeHTTPClient(base_client.HTTPClient):
(method, url, callback))
# Note the call
- self.callstack.append((method, url, kwargs.get('body', None)))
+ self.callstack.append((method, url, kwargs.get('body')))
status, headers, body = getattr(self, callback)(**kwargs)
r = utils.TestResponse({
diff --git a/novaclient/v1_1/flavor_access.py b/novaclient/v1_1/flavor_access.py
index d847d061..29c1f84f 100644
--- a/novaclient/v1_1/flavor_access.py
+++ b/novaclient/v1_1/flavor_access.py
@@ -31,9 +31,9 @@ class FlavorAccessManager(base.ManagerWithFind):
resource_class = FlavorAccess
def list(self, **kwargs):
- if kwargs.get('flavor', None):
+ if kwargs.get('flavor'):
return self._list_by_flavor(kwargs['flavor'])
- elif kwargs.get('tenant', None):
+ elif kwargs.get('tenant'):
return self._list_by_tenant(kwargs['tenant'])
else:
raise NotImplementedError(_('Unknown list options.'))