Skip to content

Commit 8da2540

Browse files
committed
[docker-py] Make _TopResult typed dict local
1 parent 2ceca4c commit 8da2540

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

stubs/docker/docker/api/container.pyi

Lines changed: 7 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, TopResult
9+
from ..types import ContainerConfig, EndpointConfig, HostConfig, NetworkingConfig
1010

1111
@type_check_only
1212
class _HasId(TypedDict):
@@ -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) -> TopResult: ...
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: 7 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, TopResult, Ulimit
9+
from docker.types.containers import DeviceRequest, LogConfig, Ulimit
1010
from docker.types.daemon import CancellableStream
1111
from docker.types.services import Mount
1212

@@ -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) -> TopResult: ...
99+
def top(self, *, ps_args: str | None = None) -> _TopResult: ...
95100
def unpause(self): ...
96101
def update(
97102
self,

stubs/docker/docker/types/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ from .containers import (
33
DeviceRequest as DeviceRequest,
44
HostConfig as HostConfig,
55
LogConfig as LogConfig,
6-
TopResult as TopResult,
76
Ulimit as Ulimit,
87
)
98
from .daemon import CancellableStream as CancellableStream

stubs/docker/docker/types/containers.pyi

Lines changed: 1 addition & 6 deletions
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, TypedDict, type_check_only
3+
from typing import Any, Final, Literal
44

55
from docker._types import ContainerWeightDevice
66

@@ -172,8 +172,3 @@ 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)