Skip to content

Commit

Permalink
Merge branch 'master' into add-mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Sep 24, 2023
2 parents 835e11b + 1d70730 commit 3d0123f
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,6 +31,7 @@
from io import BytesIO
from random import random
from threading import Thread
from typing import BinaryIO
from urllib.parse import urlunsplit
from xml.etree import ElementTree as ET

Expand Down Expand Up @@ -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 Sse, SseCustomerKey
from .sseconfig import SSEConfig
from .tagging import Tagging
from .versioningconfig import VersioningConfig
Expand Down Expand Up @@ -1077,9 +1078,17 @@ def fget_object(self, bucket_name, object_name, file_path,
response.close()
response.release_conn()

def get_object(self, bucket_name, object_name, offset=0, length=0,
request_headers=None, ssec=None, version_id=None,
extra_query_params=None):
def get_object(
self,
bucket_name: str,
object_name: str,
offset: int = 0,
length: int = 0,
request_headers: dict[str, str] | None = None,
ssec: SseCustomerKey | None = None,
version_id: str | None = None,
extra_query_params: dict[str, str] | None = None
) -> urllib3.BaseHTTPResponse:
"""
Get data of an object. Returned response should be closed after use to
release network resources. To reuse the connection, it's required to
Expand Down Expand Up @@ -1604,11 +1613,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 = 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.
Expand Down

0 comments on commit 3d0123f

Please sign in to comment.