Skip to content

Commit 2ceca4c

Browse files
committed
[docker-py] Fix Container.top() return type
1 parent cc79232 commit 2ceca4c

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

stubs/docker/docker/api/container.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from typing_extensions import TypeAlias
66
from docker._types import WaitContainerResponse
77
from docker.types.daemon import CancellableStream
88

9-
from ..types import ContainerConfig, EndpointConfig, HostConfig, NetworkingConfig
9+
from ..types import ContainerConfig, EndpointConfig, HostConfig, NetworkingConfig, TopResult
1010

1111
@type_check_only
1212
class _HasId(TypedDict):
@@ -145,7 +145,7 @@ class ContainerApiMixin:
145145
def start(self, container: _Container) -> None: ...
146146
def stats(self, container: _Container, decode: bool | None = None, stream: bool = True, one_shot: bool | None = None): ...
147147
def stop(self, container: _Container, timeout: int | None = None) -> None: ...
148-
def top(self, container: _Container, ps_args: str | None = None) -> str: ...
148+
def top(self, container: _Container, ps_args: str | None = None) -> TopResult: ...
149149
def unpause(self, container: _Container) -> None: ...
150150
def update_container(
151151
self,

stubs/docker/docker/models/containers.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from typing_extensions import NotRequired
66

77
from docker._types import ContainerWeightDevice, WaitContainerResponse
88
from docker.types import EndpointConfig
9-
from docker.types.containers import DeviceRequest, LogConfig, Ulimit
9+
from docker.types.containers import DeviceRequest, LogConfig, TopResult, Ulimit
1010
from docker.types.daemon import CancellableStream
1111
from docker.types.services import Mount
1212

@@ -91,7 +91,7 @@ class Container(Model):
9191
def start(self) -> None: ...
9292
def stats(self, **kwargs): ...
9393
def stop(self, *, timeout: float | None = None) -> None: ...
94-
def top(self, *, ps_args: str | None = None) -> str: ...
94+
def top(self, *, ps_args: str | None = None) -> TopResult: ...
9595
def unpause(self): ...
9696
def update(
9797
self,

stubs/docker/docker/types/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from .containers import (
33
DeviceRequest as DeviceRequest,
44
HostConfig as HostConfig,
55
LogConfig as LogConfig,
6+
TopResult as TopResult,
67
Ulimit as Ulimit,
78
)
89
from .daemon import CancellableStream as CancellableStream

stubs/docker/docker/types/containers.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from _typeshed import Incomplete
22
from collections.abc import Iterable, Mapping
3-
from typing import Any, Final, Literal
3+
from typing import Any, Final, Literal, TypedDict, type_check_only
44

55
from docker._types import ContainerWeightDevice
66

@@ -172,3 +172,8 @@ class ContainerConfig(dict[str, Incomplete]):
172172
stop_timeout: int | None = None,
173173
runtime: str | None = None,
174174
) -> None: ...
175+
176+
@type_check_only
177+
class TopResult(TypedDict):
178+
Titles: list[str]
179+
Processes: list[list[str]]

0 commit comments

Comments
 (0)