From b2f6e5221b180d42a3770543a72036baa52b3907 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 28 May 2024 12:55:18 +0100 Subject: [PATCH] Add types to docker.models.containers.Container.logs (#12044) --- stubs/docker/docker/models/containers.pyi | 30 +++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/stubs/docker/docker/models/containers.pyi b/stubs/docker/docker/models/containers.pyi index 763ebb9f5..57613bacc 100644 --- a/stubs/docker/docker/models/containers.pyi +++ b/stubs/docker/docker/models/containers.pyi @@ -1,5 +1,6 @@ +import datetime from _typeshed import Incomplete -from typing import Literal, NamedTuple +from typing import Literal, NamedTuple, overload from docker.types.daemon import CancellableStream @@ -44,7 +45,32 @@ class Container(Model): self, path, chunk_size: int | None = 2097152, encode_stream: bool = False ) -> tuple[Incomplete, Incomplete]: ... def kill(self, signal: Incomplete | None = None): ... - def logs(self, **kwargs) -> CancellableStream | bytes: ... + @overload + def logs( + self, + *, + stdout: bool = True, + stderr: bool = True, + stream: Literal[True], + timestamps: bool = False, + tail: Literal["all"] | int = "all", + since: datetime.datetime | float | None = None, + follow: bool | None = None, + until: datetime.datetime | float | None = None, + ) -> CancellableStream: ... + @overload + def logs( + self, + *, + stdout: bool = True, + stderr: bool = True, + stream: Literal[False] = False, + timestamps: bool = False, + tail: Literal["all"] | int = "all", + since: datetime.datetime | float | None = None, + follow: bool | None = None, + until: datetime.datetime | float | None = None, + ) -> bytes: ... def pause(self): ... def put_archive(self, path: str, data) -> bool: ... def remove(self, **kwargs) -> None: ...