You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2022/01/28 22:44:48 UTC
[libcloud] 06/08: Reformat code with black.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 6b8cee9538dbd4d820726b91e695919fac39c1ca
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jan 28 23:41:32 2022 +0100
Reformat code with black.
---
libcloud/common/google.py | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/libcloud/common/google.py b/libcloud/common/google.py
index 0d0f194..fa305b4 100644
--- a/libcloud/common/google.py
+++ b/libcloud/common/google.py
@@ -522,11 +522,12 @@ class GoogleServiceAcctAuthConnection(GoogleBaseAuthConnection):
if os.path.exists(key_path) and os.path.isfile(key_path):
# Assume it's a file and read it
try:
- with open(key_path, 'r') as f:
+ with open(key_path, "r") as f:
key_content = f.read()
except IOError:
- raise GoogleAuthError("Missing (or unreadable) key "
- "file: '%s'" % key)
+ raise GoogleAuthError(
+ "Missing (or unreadable) key " "file: '%s'" % key
+ )
else:
# assume it's a PEM str or serialized JSON str
key_content = key
@@ -542,27 +543,22 @@ class GoogleServiceAcctAuthConnection(GoogleBaseAuthConnection):
# it's been a PEM string all along
pass
finally:
- if 'private_key' in key_content:
- key = key_content['private_key']
+ if "private_key" in key_content:
+ key = key_content["private_key"]
else:
key = key_content
try:
# check if the key is actually a PEM encoded private key
serialization.load_pem_private_key(
- b(key),
- password=None,
- backend=default_backend()
+ b(key), password=None, backend=default_backend()
)
except ValueError as e:
- raise GoogleAuthError("Unable to decode provided PEM key: %s" %
- e)
+ raise GoogleAuthError("Unable to decode provided PEM key: %s" % e)
except TypeError as e:
- raise GoogleAuthError("Unable to decode provided PEM key: %s" %
- e)
+ raise GoogleAuthError("Unable to decode provided PEM key: %s" % e)
except exceptions.UnsupportedAlgorithm as e:
- raise GoogleAuthError("Unable to decode provided PEM key: %s" %
- e)
+ raise GoogleAuthError("Unable to decode provided PEM key: %s" % e)
super(GoogleServiceAcctAuthConnection, self).__init__(
user_id, key, *args, **kwargs