diff --git a/stubs/docker/docker/api/container.pyi b/stubs/docker/docker/api/container.pyi index 790524e23376..9deb1d16d76b 100644 --- a/stubs/docker/docker/api/container.pyi +++ b/stubs/docker/docker/api/container.pyi @@ -1,5 +1,7 @@ from _typeshed import Incomplete -from typing import Literal +from typing import Literal, overload + +from docker.types.daemon import CancellableStream class ContainerApiMixin: def attach( @@ -67,18 +69,46 @@ class ContainerApiMixin: def get_archive(self, container, path, chunk_size=2097152, encode_stream: bool = False): ... def inspect_container(self, container): ... def kill(self, container, signal: Incomplete | None = None) -> None: ... + @overload def logs( self, container, stdout: bool = True, stderr: bool = True, - stream: bool = False, + *, + stream: Literal[True], timestamps: bool = False, tail: Literal["all"] | int = "all", since: Incomplete | None = None, follow: Incomplete | None = None, until: Incomplete | None = None, - ): ... + ) -> CancellableStream: ... + @overload + def logs( + self, + container, + stdout: bool, + stderr: bool, + stream: Literal[True], + timestamps: bool = False, + tail: Literal["all"] | int = "all", + since: Incomplete | None = None, + follow: Incomplete | None = None, + until: Incomplete | None = None, + ) -> CancellableStream: ... + @overload + def logs( + self, + container, + stdout: bool = True, + stderr: bool = True, + stream: Literal[False] = False, + timestamps: bool = False, + tail: Literal["all"] | int = "all", + since: Incomplete | None = None, + follow: Incomplete | None = None, + until: Incomplete | None = None, + ) -> bytes: ... def pause(self, container) -> None: ... def port(self, container, private_port): ... def put_archive(self, container, path, data): ... diff --git a/stubs/docker/docker/models/containers.pyi b/stubs/docker/docker/models/containers.pyi index 22bb97b5b30e..774a02a972b1 100644 --- a/stubs/docker/docker/models/containers.pyi +++ b/stubs/docker/docker/models/containers.pyi @@ -1,6 +1,8 @@ from _typeshed import Incomplete from typing import NamedTuple +from docker.types.daemon import CancellableStream + from .images import Image from .resource import Collection, Model @@ -40,7 +42,7 @@ class Container(Model): def export(self, chunk_size=2097152): ... def get_archive(self, path, chunk_size=2097152, encode_stream: bool = False): ... def kill(self, signal: Incomplete | None = None): ... - def logs(self, **kwargs): ... + def logs(self, **kwargs) -> CancellableStream | bytes: ... def pause(self): ... def put_archive(self, path, data): ... def remove(self, **kwargs) -> None: ...