Skip to content

Commit

Permalink
[docker] Add a number of types to docker.models.containers.Container (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtheturtle authored Jun 16, 2024
1 parent 77ef4d6 commit 1af9de6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
3 changes: 3 additions & 0 deletions stubs/docker/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions stubs/docker/docker/api/container.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
26 changes: 20 additions & 6 deletions stubs/docker/docker/models/containers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down

0 comments on commit 1af9de6

Please sign in to comment.