Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stubs/docker/docker/api/container.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from typing_extensions import TypeAlias
from docker._types import WaitContainerResponse
from docker.types.daemon import CancellableStream

from ..types import ContainerConfig, EndpointConfig, HostConfig, NetworkingConfig
from ..types import ContainerConfig, EndpointConfig, HostConfig, NetworkingConfig, TopResult

@type_check_only
class _HasId(TypedDict):
Expand Down Expand Up @@ -145,7 +145,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,
Expand Down
4 changes: 2 additions & 2 deletions stubs/docker/docker/models/containers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from typing_extensions import NotRequired

from docker._types import ContainerWeightDevice, WaitContainerResponse
from docker.types import EndpointConfig
from docker.types.containers import DeviceRequest, LogConfig, Ulimit
from docker.types.containers import DeviceRequest, LogConfig, TopResult, Ulimit
from docker.types.daemon import CancellableStream
from docker.types.services import Mount

Expand Down Expand Up @@ -91,7 +91,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,
Expand Down
1 change: 1 addition & 0 deletions stubs/docker/docker/types/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from .containers import (
DeviceRequest as DeviceRequest,
HostConfig as HostConfig,
LogConfig as LogConfig,
TopResult as TopResult,
Ulimit as Ulimit,
)
from .daemon import CancellableStream as CancellableStream
Expand Down
7 changes: 6 additions & 1 deletion stubs/docker/docker/types/containers.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Iterable, Mapping
from typing import Any, Final, Literal
from typing import Any, Final, Literal, TypedDict, type_check_only

from docker._types import ContainerWeightDevice

Expand Down Expand Up @@ -172,3 +172,8 @@ class ContainerConfig(dict[str, Incomplete]):
stop_timeout: int | None = None,
runtime: str | None = None,
) -> None: ...

@type_check_only
class TopResult(TypedDict):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typecheck-only types need to be prefixed with _ to make it clear to users that this is "special" in some way, even if their IDE or editor doesn't point out the fact that it can't be imported at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes! You are right. I'll fix it now

Titles: list[str]
Processes: list[list[str]]