Add remaining parameter types to docker.api.container logs (#11907)

This commit is contained in:
Adam Dangoor
2024-05-12 16:12:32 +01:00
committed by GitHub
parent ef0a5c2d12
commit 96697a835b

View File

@@ -1,8 +1,20 @@
import datetime
from _typeshed import Incomplete
from typing import Literal, overload
from typing import Literal, TypedDict, overload, type_check_only
from typing_extensions import TypeAlias
from docker.types.daemon import CancellableStream
@type_check_only
class _HasId(TypedDict):
Id: str
@type_check_only
class _HasID(TypedDict):
ID: str
_Container: TypeAlias = _HasId | _HasID | str
class ContainerApiMixin:
def attach(
self, container, stdout: bool = True, stderr: bool = True, stream: bool = False, logs: bool = False, demux: bool = False
@@ -72,42 +84,42 @@ class ContainerApiMixin:
@overload
def logs(
self,
container,
container: _Container,
stdout: bool = True,
stderr: bool = True,
*,
stream: Literal[True],
timestamps: bool = False,
tail: Literal["all"] | int = "all",
since: Incomplete | None = None,
follow: Incomplete | None = None,
until: Incomplete | None = None,
since: datetime.datetime | float | None = None,
follow: bool | None = None,
until: datetime.datetime | float | None = None,
) -> CancellableStream: ...
@overload
def logs(
self,
container,
container: _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,
since: datetime.datetime | float | None = None,
follow: bool | None = None,
until: datetime.datetime | float | None = None,
) -> CancellableStream: ...
@overload
def logs(
self,
container,
container: _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,
since: datetime.datetime | float | None = None,
follow: bool | None = None,
until: datetime.datetime | float | None = None,
) -> bytes: ...
def pause(self, container) -> None: ...
def port(self, container, private_port): ...