diff --git a/stubs/docker/docker/api/container.pyi b/stubs/docker/docker/api/container.pyi index a44bd63fb4ee..f8e225493ee6 100644 --- a/stubs/docker/docker/api/container.pyi +++ b/stubs/docker/docker/api/container.pyi @@ -16,6 +16,11 @@ class _HasId(TypedDict): class _HasID(TypedDict): ID: str +@type_check_only +class _TopResult(TypedDict): + Titles: list[str] + Processes: list[list[str]] + _Container: TypeAlias = _HasId | _HasID | str class ContainerApiMixin: @@ -145,7 +150,7 @@ class ContainerApiMixin: 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) -> str: ... + def top(self, container: _Container, ps_args: str | None = None) -> _TopResult: ... 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 dddbb847c88e..7b12e2403bed 100644 --- a/stubs/docker/docker/models/containers.pyi +++ b/stubs/docker/docker/models/containers.pyi @@ -18,6 +18,11 @@ class _RestartPolicy(TypedDict): MaximumRetryCount: NotRequired[int] Name: NotRequired[Literal["always", "on-failure"]] +@type_check_only +class _TopResult(TypedDict): + Titles: list[str] + Processes: list[list[str]] + class Container(Model): @property def name(self) -> str | None: ... @@ -91,7 +96,7 @@ class Container(Model): def start(self) -> None: ... def stats(self, **kwargs): ... def stop(self, *, timeout: float | None = None) -> None: ... - def top(self, *, ps_args: str | None = None) -> str: ... + def top(self, *, ps_args: str | None = None) -> _TopResult: ... def unpause(self): ... def update( self,