From bc7bdf028ded88803d6b171ee04fea54a4fff22d Mon Sep 17 00:00:00 2001 From: sguazt <marco.guazzone@gmail.com> Date: Thu, 28 Jan 2021 14:42:44 +0100 Subject: [PATCH] GCP: small optimization (exploit the fact that 'None', empty strings and empty lists evaluate to 'False'). --- easycloud/modules/gcp_googleapi/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easycloud/modules/gcp_googleapi/manager.py b/easycloud/modules/gcp_googleapi/manager.py index ecc6f77..3bbfc83 100644 --- a/easycloud/modules/gcp_googleapi/manager.py +++ b/easycloud/modules/gcp_googleapi/manager.py @@ -215,7 +215,7 @@ class GCP(MetaManager): credentials = google.oauth2.service_account.Credentials.from_service_account_file(self.conf.gcp_service_account_file, scopes=SCOPES) elif self.conf.gcp_auth_type == self.conf.OAUTH2_CLIENT_AUTH_TYPE: flow = None - if self.conf.gcp_client_secrets_file is not None and len(self.conf.gcp_client_secrets_file) > 0: + if self.conf.gcp_client_secrets_file: flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(self.conf.gcp_client_secrets_file, SCOPES) else: flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_config( -- GitLab