From fc86a3b06d3664386887bbb40b182e49ba51a597 Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Sat, 11 Apr 2020 01:55:24 +0530 Subject: [PATCH] fix formatting as per pep8 in sse.py --- minio/sse.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/minio/sse.py b/minio/sse.py index 1b39fcf06..ed23b6c49 100644 --- a/minio/sse.py +++ b/minio/sse.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# MinIO Python Library for Amazon S3 Compatible Cloud Storage, (C) 2018 MinIO, Inc. +# MinIO Python Library for Amazon S3 Compatible Cloud Storage, +# (C) 2018 MinIO, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,12 +29,14 @@ import json from .error import (InvalidArgumentError, InvalidSizeError) + class SSE_C(object): def __init__(self, key): self.key = key if len(self.key) != 32: - raise InvalidSizeError("SSE-C keys need to be 256 bit base64 encoded") + raise InvalidSizeError( + "SSE-C keys need to be 256 bit base64 encoded") def type(self): return "SSE-C" @@ -48,16 +51,18 @@ def marshal(self): "X-Amz-Server-Side-Encryption-Customer-Algorithm": "AES256", "X-Amz-Server-Side-Encryption-Customer-Key": b64key.decode(), "X-Amz-Server-Side-Encryption-Customer-Key-MD5": md5_key - } + } return keys + class copy_SSE_C(object): def __init__(self, key): self.key = key if len(self.key) != 32: - raise InvalidArgumentError("Length of Customer key must be 32 Bytes") + raise InvalidArgumentError( + "Length of Customer key must be 32 Bytes") def type(self): return "copy_SSE-C" @@ -68,9 +73,12 @@ def marshal(self): md5.update(self.key) md5_key = base64.b64encode(md5.digest()).decode() keys = { - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm":"AES256", - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": b64key.decode(), - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-MD5": md5_key + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": + "AES256", + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": + b64key.decode(), + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-MD5": + md5_key } return keys @@ -86,15 +94,15 @@ def type(self): def marshal(self): keys = { "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": self.key, - "X-Amz-Server-Side-Encryption":"aws:kms" + "X-Amz-Server-Side-Encryption": "aws:kms" } if self.context: - ctx_str = json.dumps(self.context) - ctx_str = bytes(ctx_str, 'utf-8') - b64key = base64.b64encode(ctx_str) - header = {"X-Amz-Server-Side-Encryption-Context": b64key.decode()} - keys.update(header) + ctx_str = json.dumps(self.context) + ctx_str = bytes(ctx_str, 'utf-8') + b64key = base64.b64encode(ctx_str) + header = {"X-Amz-Server-Side-Encryption-Context": b64key.decode()} + keys.update(header) return keys @@ -105,6 +113,6 @@ def type(self): def marshal(self): keys = { - "X-Amz-Server-Side-Encryption":"AES256" + "X-Amz-Server-Side-Encryption": "AES256" } return keys