Skip to content

Commit 1af9de6

Browse files
[docker] Add a number of types to docker.models.containers.Container (#12077)
1 parent 77ef4d6 commit 1af9de6

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

stubs/docker/@tests/stubtest_allowlist.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ docker.transport.sshconn
88

99
# model is always set by child classes
1010
docker.models.resource.Collection.model
11+
12+
# keyword arguments are now unsupported
13+
docker.api.container.ContainerApiMixin.start

stubs/docker/docker/api/container.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ class ContainerApiMixin:
154154
def rename(self, container: _Container, name: str) -> None: ...
155155
def resize(self, container: _Container, height: int, width: int) -> None: ...
156156
def restart(self, container: _Container, timeout: int = 10) -> None: ...
157-
def start(self, container: _Container, *args, **kwargs) -> None: ...
157+
def start(self, container: _Container) -> None: ...
158158
def stats(self, container: _Container, decode: bool | None = None, stream: bool = True, one_shot: bool | None = None): ...
159159
def stop(self, container: _Container, timeout: int | None = None) -> None: ...
160-
def top(self, container: _Container, ps_args: str | None = None): ...
160+
def top(self, container: _Container, ps_args: str | None = None) -> str: ...
161161
def unpause(self, container: _Container) -> None: ...
162162
def update_container(
163163
self,

stubs/docker/docker/models/containers.pyi

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,32 @@ class Container(Model):
7171
follow: bool | None = None,
7272
until: datetime.datetime | float | None = None,
7373
) -> bytes: ...
74-
def pause(self): ...
74+
def pause(self) -> None: ...
7575
def put_archive(self, path: str, data) -> bool: ...
76-
def remove(self, **kwargs) -> None: ...
76+
def remove(self, *, v: bool = False, link: bool = False, force: bool = False) -> None: ...
7777
def rename(self, name: str): ...
7878
def resize(self, height: int, width: int): ...
79-
def restart(self, **kwargs): ...
80-
def start(self, **kwargs) -> None: ...
79+
def restart(self, *, timeout: float | None = 10): ...
80+
def start(self) -> None: ...
8181
def stats(self, **kwargs): ...
8282
def stop(self, *, timeout: float | None = None) -> None: ...
83-
def top(self, **kwargs): ...
83+
def top(self, *, ps_args: str | None = None) -> str: ...
8484
def unpause(self): ...
85-
def update(self, **kwargs): ...
85+
def update(
86+
self,
87+
*,
88+
blkio_weight: int | None = None,
89+
cpu_period: int | None = None,
90+
cpu_quota: int | None = None,
91+
cpu_shares: int | None = None,
92+
cpuset_cpus: str | None = None,
93+
cpuset_mems: str | None = None,
94+
mem_limit: float | str | None = None,
95+
mem_reservation: float | str | None = None,
96+
memswap_limit: int | str | None = None,
97+
kernel_memory: int | str | None = None,
98+
restart_policy: Incomplete | None = None,
99+
): ...
86100
def wait(self, *, timeout: float | None = None, condition: Literal["not-running", "next-exit", "removed"] | None = None): ...
87101

88102
class ContainerCollection(Collection[Container]):

0 commit comments

Comments
 (0)