From e2158b7ef4c307ff5be7bd2ef0ca3044f37759d4 Mon Sep 17 00:00:00 2001 From: "ting.wang" Date: Sat, 20 Feb 2016 14:28:08 +0800 Subject: Clean 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: Ia82f7469cd019509bbeccbfe54b15eeedc7bb6ea --- openstackclient/common/clientmanager.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'openstackclient/common/clientmanager.py') diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 78a0ae6e..fd88bdec 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -90,7 +90,7 @@ class ClientManager(object): self._cli_options = cli_options self._api_version = api_version self._pw_callback = pw_func - self._url = self._cli_options.auth.get('url', None) + self._url = self._cli_options.auth.get('url') self._region_name = self._cli_options.region_name self._interface = self._cli_options.interface @@ -146,7 +146,7 @@ class ClientManager(object): # Horrible hack alert...must handle prompt for null password if # password auth is requested. if (self.auth_plugin_name.endswith('password') and - not self._cli_options.auth.get('password', None)): + not self._cli_options.auth.get('password')): self._cli_options.auth['password'] = self._pw_callback() (auth_plugin, self._auth_params) = auth.build_auth_params( @@ -162,9 +162,9 @@ class ClientManager(object): # PROJECT_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability. if (self._api_version.get('identity') == '3' and self.auth_plugin_name.endswith('password') and - not self._auth_params.get('project_domain_id', None) and + not self._auth_params.get('project_domain_id') and not self.auth_plugin_name.startswith('v2') and - not self._auth_params.get('project_domain_name', None)): + not self._auth_params.get('project_domain_name')): self._auth_params['project_domain_id'] = default_domain # NOTE(stevemar): If USER_DOMAIN_ID or USER_DOMAIN_NAME is present, @@ -173,8 +173,8 @@ class ClientManager(object): if (self._api_version.get('identity') == '3' and self.auth_plugin_name.endswith('password') and not self.auth_plugin_name.startswith('v2') and - not self._auth_params.get('user_domain_id', None) and - not self._auth_params.get('user_domain_name', None)): + not self._auth_params.get('user_domain_id') and + not self._auth_params.get('user_domain_name')): self._auth_params['user_domain_id'] = default_domain # For compatibility until all clients can be updated -- cgit v1.2.1