Skip to content

Commit c10e368

Browse files
authored
[docker-py] Fix Container.top() return type (#15067)
1 parent 6f7cecb commit c10e368

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

stubs/docker/docker/api/container.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class _HasId(TypedDict):
1616
class _HasID(TypedDict):
1717
ID: str
1818

19+
@type_check_only
20+
class _TopResult(TypedDict):
21+
Titles: list[str]
22+
Processes: list[list[str]]
23+
1924
_Container: TypeAlias = _HasId | _HasID | str
2025

2126
class ContainerApiMixin:
@@ -145,7 +150,7 @@ class ContainerApiMixin:
145150
def start(self, container: _Container) -> None: ...
146151
def stats(self, container: _Container, decode: bool | None = None, stream: bool = True, one_shot: bool | None = None): ...
147152
def stop(self, container: _Container, timeout: int | None = None) -> None: ...
148-
def top(self, container: _Container, ps_args: str | None = None) -> str: ...
153+
def top(self, container: _Container, ps_args: str | None = None) -> _TopResult: ...
149154
def unpause(self, container: _Container) -> None: ...
150155
def update_container(
151156
self,

stubs/docker/docker/models/containers.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class _RestartPolicy(TypedDict):
1818
MaximumRetryCount: NotRequired[int]
1919
Name: NotRequired[Literal["always", "on-failure"]]
2020

21+
@type_check_only
22+
class _TopResult(TypedDict):
23+
Titles: list[str]
24+
Processes: list[list[str]]
25+
2126
class Container(Model):
2227
@property
2328
def name(self) -> str | None: ...
@@ -91,7 +96,7 @@ class Container(Model):
9196
def start(self) -> None: ...
9297
def stats(self, **kwargs): ...
9398
def stop(self, *, timeout: float | None = None) -> None: ...
94-
def top(self, *, ps_args: str | None = None) -> str: ...
99+
def top(self, *, ps_args: str | None = None) -> _TopResult: ...
95100
def unpause(self): ...
96101
def update(
97102
self,

0 commit comments

Comments
 (0)