From 1af9de664f41b51bd3b71dac349564c5c25df810 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 16 Jun 2024 11:05:42 +0100 Subject: [PATCH] [docker] Add a number of types to docker.models.containers.Container (#12077) --- stubs/docker/@tests/stubtest_allowlist.txt | 3 +++ stubs/docker/docker/api/container.pyi | 4 ++-- stubs/docker/docker/models/containers.pyi | 26 +++++++++++++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/stubs/docker/@tests/stubtest_allowlist.txt b/stubs/docker/@tests/stubtest_allowlist.txt index 298579cad..beed27b00 100644 --- a/stubs/docker/@tests/stubtest_allowlist.txt +++ b/stubs/docker/@tests/stubtest_allowlist.txt @@ -8,3 +8,6 @@ docker.transport.sshconn # model is always set by child classes docker.models.resource.Collection.model + +# keyword arguments are now unsupported +docker.api.container.ContainerApiMixin.start diff --git a/stubs/docker/docker/api/container.pyi b/stubs/docker/docker/api/container.pyi index 453863adc..e87d26cca 100644 --- a/stubs/docker/docker/api/container.pyi +++ b/stubs/docker/docker/api/container.pyi @@ -154,10 +154,10 @@ class ContainerApiMixin: def rename(self, container: _Container, name: str) -> None: ... def resize(self, container: _Container, height: int, width: int) -> None: ... def restart(self, container: _Container, timeout: int = 10) -> None: ... - def start(self, container: _Container, *args, **kwargs) -> None: ... + def start(self, container: _Container) -> None: ... def stats(self, container: _Container, decode: bool | None = None, stream: bool = True, one_shot: bool | None = None): ... def stop(self, container: _Container, timeout: int | None = None) -> None: ... - def top(self, container: _Container, ps_args: str | None = None): ... + def top(self, container: _Container, ps_args: str | None = None) -> str: ... def unpause(self, container: _Container) -> None: ... def update_container( self, diff --git a/stubs/docker/docker/models/containers.pyi b/stubs/docker/docker/models/containers.pyi index eeb40ee19..305c7763f 100644 --- a/stubs/docker/docker/models/containers.pyi +++ b/stubs/docker/docker/models/containers.pyi @@ -71,18 +71,32 @@ class Container(Model): follow: bool | None = None, until: datetime.datetime | float | None = None, ) -> bytes: ... - def pause(self): ... + def pause(self) -> None: ... def put_archive(self, path: str, data) -> bool: ... - def remove(self, **kwargs) -> None: ... + def remove(self, *, v: bool = False, link: bool = False, force: bool = False) -> None: ... def rename(self, name: str): ... def resize(self, height: int, width: int): ... - def restart(self, **kwargs): ... - def start(self, **kwargs) -> None: ... + def restart(self, *, timeout: float | None = 10): ... + def start(self) -> None: ... def stats(self, **kwargs): ... def stop(self, *, timeout: float | None = None) -> None: ... - def top(self, **kwargs): ... + def top(self, *, ps_args: str | None = None) -> str: ... def unpause(self): ... - def update(self, **kwargs): ... + def update( + self, + *, + blkio_weight: int | None = None, + cpu_period: int | None = None, + cpu_quota: int | None = None, + cpu_shares: int | None = None, + cpuset_cpus: str | None = None, + cpuset_mems: str | None = None, + mem_limit: float | str | None = None, + mem_reservation: float | str | None = None, + memswap_limit: int | str | None = None, + kernel_memory: int | str | None = None, + restart_policy: Incomplete | None = None, + ): ... def wait(self, *, timeout: float | None = None, condition: Literal["not-running", "next-exit", "removed"] | None = None): ... class ContainerCollection(Collection[Container]):