mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add return type to Docker Container.logs (#11888)
This commit is contained in:
@@ -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): ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user