From 28d43713b03aaade971cca370a39bbed34ef289b Mon Sep 17 00:00:00 2001 From: Trim21 Date: Wed, 30 Aug 2023 13:01:14 +0800 Subject: [PATCH 1/4] Update api.py --- minio/api.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/minio/api.py b/minio/api.py index 72364774a..83c528a17 100644 --- a/minio/api.py +++ b/minio/api.py @@ -21,7 +21,7 @@ Simple Storage Service (aka S3) client to perform bucket and object operations. """ -from __future__ import absolute_import +from __future__ import absolute_import, annotations import itertools import os @@ -31,6 +31,7 @@ from io import BytesIO from random import random from threading import Thread +from typing import Any, BinaryIO from urllib.parse import urlunsplit from xml.etree import ElementTree as ET @@ -61,7 +62,7 @@ from .retention import Retention from .select import SelectObjectReader, SelectRequest from .signer import presign_v4, sign_v4_s3 -from .sse import SseCustomerKey +from .sse import SseCustomerKey, Sse from .sseconfig import SSEConfig from .tagging import Tagging from .versioningconfig import VersioningConfig @@ -1602,11 +1603,22 @@ def _upload_part_task(self, args): """Upload_part task for ThreadPool.""" return args[5], self._upload_part(*args) - def put_object(self, bucket_name, object_name, data, length, - content_type="application/octet-stream", - metadata=None, sse=None, progress=None, - part_size=0, num_parallel_uploads=3, - tags=None, retention=None, legal_hold=False): + def put_object( + self, + bucket_name: str, + object_name: str, + data: BinaryIO, + length: int, + content_type: str = "application/octet-stream", + metadata: dict[str, str] | None = None, + sse: Sse = None, + progress: Thread | None = None, + part_size: int = 0, + num_parallel_uploads: int = 3, + tags: Tags | None = None, + retention: Retention | None = None, + legal_hold: bool = False + ) -> ObjectWriteResult: """ Uploads data from a stream to an object in a bucket. From 1f8ce01957b179cf94534c783b73ff71adbd2d98 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Wed, 30 Aug 2023 13:01:46 +0800 Subject: [PATCH 2/4] Update api.py --- minio/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minio/api.py b/minio/api.py index 83c528a17..4a30b7d08 100644 --- a/minio/api.py +++ b/minio/api.py @@ -31,7 +31,7 @@ from io import BytesIO from random import random from threading import Thread -from typing import Any, BinaryIO +from typing import BinaryIO from urllib.parse import urlunsplit from xml.etree import ElementTree as ET From 17876ae10939e18d40540010e4d418e03bc81f5e Mon Sep 17 00:00:00 2001 From: Trim21 Date: Wed, 30 Aug 2023 13:03:14 +0800 Subject: [PATCH 3/4] Update api.py --- minio/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minio/api.py b/minio/api.py index 4a30b7d08..5c0da0494 100644 --- a/minio/api.py +++ b/minio/api.py @@ -1611,7 +1611,7 @@ def put_object( length: int, content_type: str = "application/octet-stream", metadata: dict[str, str] | None = None, - sse: Sse = None, + sse: Sse | None = None, progress: Thread | None = None, part_size: int = 0, num_parallel_uploads: int = 3, From 3b5eb9c052fe129e24df2751036370ef3bf90a44 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Wed, 30 Aug 2023 17:49:14 +0800 Subject: [PATCH 4/4] Update api.py --- minio/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minio/api.py b/minio/api.py index 5c0da0494..cafa81093 100644 --- a/minio/api.py +++ b/minio/api.py @@ -62,7 +62,7 @@ from .retention import Retention from .select import SelectObjectReader, SelectRequest from .signer import presign_v4, sign_v4_s3 -from .sse import SseCustomerKey, Sse +from .sse import Sse, SseCustomerKey from .sseconfig import SSEConfig from .tagging import Tagging from .versioningconfig import VersioningConfig