From a9d7e861f7a46ae7acd56569326adef302e10f29 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 14 May 2024 10:15:32 +0100 Subject: [PATCH] Add a number of types to docker.models.containers (#11912) --- stubs/docker/docker/models/containers.pyi | 36 ++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/stubs/docker/docker/models/containers.pyi b/stubs/docker/docker/models/containers.pyi index d3c15ebe1b4f..3f3b0f17fc78 100644 --- a/stubs/docker/docker/models/containers.pyi +++ b/stubs/docker/docker/models/containers.pyi @@ -8,17 +8,17 @@ from .resource import Collection, Model class Container(Model): @property - def name(self): ... + def name(self) -> str | None: ... @property - def image(self): ... + def image(self) -> Image | None: ... @property def labels(self): ... @property - def status(self): ... + def status(self) -> str: ... @property - def health(self): ... + def health(self) -> str: ... @property - def ports(self): ... + def ports(self) -> dict[Incomplete, Incomplete]: ... def attach(self, **kwargs): ... def attach_socket(self, **kwargs): ... def commit(self, repository: str | None = None, tag: str | None = None, **kwargs): ... @@ -38,16 +38,18 @@ class Container(Model): environment: Incomplete | None = None, workdir: Incomplete | None = None, demux: bool = False, - ): ... - def export(self, chunk_size=2097152): ... - def get_archive(self, path, chunk_size=2097152, encode_stream: bool = False): ... + ) -> ExecResult: ... + def export(self, chunk_size: int | None = 2097152) -> str: ... + def get_archive( + 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: ... def pause(self): ... - def put_archive(self, path, data): ... + def put_archive(self, path: str, data) -> bool: ... def remove(self, **kwargs) -> None: ... - def rename(self, name): ... - def resize(self, height, width): ... + def rename(self, name: str): ... + def resize(self, height: int, width: int): ... def restart(self, **kwargs): ... def start(self, **kwargs) -> None: ... def stats(self, **kwargs): ... @@ -68,22 +70,22 @@ class ContainerCollection(Collection[Container]): remove: bool = False, **kwargs, ): ... - def create(self, image: str, command: str | list[str] | None = None, **kwargs): ... # type:ignore[override] - def get(self, container_id: str): ... + def create(self, image: str, command: str | list[str] | None = None, **kwargs) -> Container: ... # type:ignore[override] + def get(self, container_id: str) -> Container: ... def list( self, all: bool = False, - before: Incomplete | None = None, + before: str | None = None, filters: Incomplete | None = None, limit: int = -1, - since: Incomplete | None = None, + since: str | None = None, sparse: bool = False, ignore_removed: bool = False, ): ... def prune(self, filters: Incomplete | None = None): ... -RUN_CREATE_KWARGS: Incomplete -RUN_HOST_CONFIG_KWARGS: Incomplete +RUN_CREATE_KWARGS: list[str] +RUN_HOST_CONFIG_KWARGS: list[str] class ExecResult(NamedTuple): exit_code: Incomplete