Skip to content

Commit 279fa11

Browse files
authored
add type hint for Minio.__init__ (#1299)
1 parent 1d70730 commit 279fa11

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

minio/api.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@
3131
from io import BytesIO
3232
from random import random
3333
from threading import Thread
34-
from typing import BinaryIO
34+
from typing import BinaryIO, TextIO
3535
from urllib.parse import urlunsplit
3636
from xml.etree import ElementTree as ET
3737

3838
import certifi
3939
import urllib3
40+
from urllib3 import PoolManager
4041
from urllib3._collections import HTTPHeaderDict
4142

4243
from . import __title__, __version__, time
4344
from .commonconfig import COPY, REPLACE, ComposeSource, CopySource, Tags
4445
from .credentials import StaticProvider
46+
from .credentials.providers import Provider
4547
from .datatypes import (CompleteMultipartUploadResult, EventIterable,
4648
ListAllMyBucketsResult, ListMultipartUploadsResult,
4749
ListPartsResult, Object, Part, PostPolicy,
@@ -113,16 +115,26 @@ class Minio: # pylint: disable=too-many-public-methods
113115
object in each process, and not share it between processes.
114116
115117
"""
118+
_region_map: dict[str, str]
119+
_base_url: BaseURL
120+
_user_agent: str
121+
_trace_stream: TextIO | None
122+
_provider: Provider | None
123+
_http: PoolManager
116124

117125
# pylint: disable=too-many-function-args
118-
def __init__(self, endpoint, access_key=None,
119-
secret_key=None,
120-
session_token=None,
121-
secure=True,
122-
region=None,
123-
http_client=None,
124-
credentials=None,
125-
cert_check=True):
126+
def __init__(
127+
self,
128+
endpoint: str,
129+
access_key: str | None = None,
130+
secret_key: str | None = None,
131+
session_token: str | None = None,
132+
secure: bool = True,
133+
region: str | None = None,
134+
http_client: urllib3.PoolManager | None = None,
135+
credentials: Provider | None = None,
136+
cert_check: bool = True
137+
):
126138
# Validate http client has correct base class.
127139
if http_client and not isinstance(
128140
http_client,

0 commit comments

Comments
 (0)