Skip to content

Commit b6807bd

Browse files
committed
Add type annotations for minio.
1 parent 6431f47 commit b6807bd

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

minio/testcontainers/minio/__init__.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,15 @@ class MinioContainer(DockerContainer):
3434
... retrieved_content = client.get_object("test", "testfile.txt").data
3535
"""
3636

37-
def __init__(
38-
self,
39-
image="minio/minio:RELEASE.2022-12-02T19-19-22Z",
40-
port_to_expose=9000,
41-
access_key="minioadmin",
42-
secret_key="minioadmin",
43-
**kwargs,
44-
):
37+
def __init__(self, image: str = "minio/minio:RELEASE.2022-12-02T19-19-22Z",
38+
port_to_expose: int = 9000, access_key: str = "minioadmin",
39+
secret_key: str = "minioadmin", **kwargs) -> None:
4540
"""
4641
Args:
47-
image (str, optional): The Docker image to use for the Minio container.
48-
Defaults to "minio/minio:RELEASE.2022-12-02T19-19-22Z".
49-
port_to_expose (int, optional): The port to expose on the container.
50-
Defaults to 9000.
51-
access_key (str, optional): The access key for client connections.
52-
Defaults to "minioadmin".
53-
secret_key (str, optional): The secret key for client connections.
54-
Defaults to "minioadmin".
42+
image: Docker image to use for the MinIO container.
43+
port_to_expose: Port to expose on the container.
44+
access_key: Access key for client connections.
45+
secret_key: Secret key for client connections.
5546
"""
5647
super(MinioContainer, self).__init__(image, **kwargs)
5748
self.port_to_expose = port_to_expose
@@ -96,14 +87,14 @@ def get_config(self) -> dict:
9687
}
9788

9889
@wait_container_is_ready(ConnectionError)
99-
def _healthcheck(self):
90+
def _healthcheck(self) -> None:
10091
"""This is an internal method used to check if the Minio container
10192
is healthy and ready to receive requests."""
10293
url = f"http://{self.get_config()['endpoint']}/minio/health/live"
10394
response: Response = get(url)
10495
response.raise_for_status()
10596

106-
def start(self):
97+
def start(self) -> "MinioContainer":
10798
"""This method starts the Minio container and runs the healthcheck
10899
to verify that the container is ready to use."""
109100
super().start()

0 commit comments

Comments
 (0)