Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
77 changes: 39 additions & 38 deletions stubs/docker/docker/models/containers.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import datetime
from _io import _BufferedReaderStream
from _typeshed import Incomplete
from collections.abc import Iterable, Iterator, Mapping
from socket import SocketIO
from typing import Literal, NamedTuple, TypedDict, overload, type_check_only
from typing_extensions import NotRequired
from typing import Any, Literal, NamedTuple, TypedDict, overload, type_check_only
from typing_extensions import NotRequired, override

from docker._types import ContainerWeightDevice, WaitContainerResponse
from docker.transport.sshconn import SSHSocket
Expand Down Expand Up @@ -38,7 +37,7 @@ class Container(Model):
@property
def health(self) -> str: ...
@property
def ports(self) -> dict[Incomplete, Incomplete]: ...
def ports(self) -> dict[str, list[dict[str, str]] | None]: ...
@overload
def attach(
self,
Expand Down Expand Up @@ -75,7 +74,7 @@ class Container(Model):
) -> CancellableStream[tuple[bytes | None, bytes | None]]: ...
def attach_socket(self, **kwargs) -> SocketIO | _BufferedReaderStream | SSHSocket: ...
def commit(self, repository: str | None = None, tag: str | None = None, **kwargs) -> Image: ...
def diff(self) -> list[dict[str, Incomplete]]: ...
def diff(self) -> list[dict[str, int | str]]: ...
def exec_run(
self,
cmd: str | list[str],
Expand All @@ -95,7 +94,7 @@ class Container(Model):
def export(self, chunk_size: int | None = 2097152) -> str: ...
def get_archive(
self, path: str, chunk_size: int | None = 2097152, encode_stream: bool = False
) -> tuple[Incomplete, Incomplete]: ...
) -> tuple[Iterator[bytes], dict[str, Any] | None]: ...
def kill(self, signal: str | int | None = None) -> None: ...
@overload
def logs(
Expand Down Expand Up @@ -130,7 +129,7 @@ class Container(Model):
def resize(self, height: int, width: int) -> None: ...
def restart(self, *, timeout: float | None = 10) -> None: ...
def start(self) -> None: ...
def stats(self, **kwargs) -> Iterator[dict[str, Incomplete]] | dict[str, Incomplete]: ...
def stats(self, **kwargs) -> Iterator[dict[str, Any]] | dict[str, Any]: ...
def stop(self, *, timeout: float | None = None) -> None: ...
def top(self, *, ps_args: str | None = None) -> _TopResult: ...
def unpause(self) -> None: ...
Expand Down Expand Up @@ -181,22 +180,22 @@ class ContainerCollection(Collection[Container]):
cpuset_cpus: str | None = None,
cpuset_mems: str | None = None,
detach: Literal[False] = False,
device_cgroup_rules: list[Incomplete] | None = None,
device_cgroup_rules: list[str] | None = None,
device_read_bps: list[Mapping[str, str | int]] | None = None,
device_read_iops: list[Mapping[str, str | int]] | None = None,
device_write_bps: list[Mapping[str, str | int]] | None = None,
device_write_iops: list[Mapping[str, str | int]] | None = None,
devices: list[str] | None = None,
device_requests: list[DeviceRequest] | None = None,
dns: list[Incomplete] | None = None,
dns_opt: list[Incomplete] | None = None,
dns_search: list[Incomplete] | None = None,
domainname: str | list[Incomplete] | None = None,
dns: list[str] | None = None,
dns_opt: list[str] | None = None,
dns_search: list[str] | None = None,
domainname: str | list[str] | None = None,
entrypoint: str | list[str] | None = None,
environment: dict[str, str] | list[str] | None = None,
extra_hosts: dict[str, str] | None = None,
group_add: Iterable[str | int] | None = None,
healthcheck: dict[Incomplete, Incomplete] | None = None,
healthcheck: dict[str, Any] | None = None,
hostname: str | None = None,
init: bool | None = None,
init_path: str | None = None,
Expand All @@ -206,7 +205,7 @@ class ContainerCollection(Collection[Container]):
labels: dict[str, str] | list[str] | None = None,
links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None,
log_config: LogConfig | None = None,
lxc_conf: dict[Incomplete, Incomplete] | None = None,
lxc_conf: dict[str, str] | None = None,
mac_address: str | None = None,
mem_limit: str | int | None = None,
mem_reservation: str | int | None = None,
Expand Down Expand Up @@ -234,9 +233,9 @@ class ContainerCollection(Collection[Container]):
shm_size: str | int | None = None,
stdin_open: bool = False,
stop_signal: str | None = None,
storage_opt: dict[Incomplete, Incomplete] | None = None,
storage_opt: dict[str, str] | None = None,
stream: bool = False,
sysctls: dict[Incomplete, Incomplete] | None = None,
sysctls: dict[str, str] | None = None,
tmpfs: dict[str, str] | None = None,
tty: bool = False,
ulimits: list[Ulimit] | None = None,
Expand Down Expand Up @@ -276,22 +275,22 @@ class ContainerCollection(Collection[Container]):
cpuset_cpus: str | None = None,
cpuset_mems: str | None = None,
detach: Literal[True],
device_cgroup_rules: list[Incomplete] | None = None,
device_cgroup_rules: list[str] | None = None,
device_read_bps: list[Mapping[str, str | int]] | None = None,
device_read_iops: list[Mapping[str, str | int]] | None = None,
device_write_bps: list[Mapping[str, str | int]] | None = None,
device_write_iops: list[Mapping[str, str | int]] | None = None,
devices: list[str] | None = None,
device_requests: list[DeviceRequest] | None = None,
dns: list[Incomplete] | None = None,
dns_opt: list[Incomplete] | None = None,
dns_search: list[Incomplete] | None = None,
domainname: str | list[Incomplete] | None = None,
dns: list[str] | None = None,
dns_opt: list[str] | None = None,
dns_search: list[str] | None = None,
domainname: str | list[str] | None = None,
entrypoint: str | list[str] | None = None,
environment: dict[str, str] | list[str] | None = None,
extra_hosts: dict[str, str] | None = None,
group_add: Iterable[str | int] | None = None,
healthcheck: dict[Incomplete, Incomplete] | None = None,
healthcheck: dict[str, Any] | None = None,
hostname: str | None = None,
init: bool | None = None,
init_path: str | None = None,
Expand All @@ -301,7 +300,7 @@ class ContainerCollection(Collection[Container]):
labels: dict[str, str] | list[str] | None = None,
links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None,
log_config: LogConfig | None = None,
lxc_conf: dict[Incomplete, Incomplete] | None = None,
lxc_conf: dict[str, str] | None = None,
mac_address: str | None = None,
mem_limit: str | int | None = None,
mem_reservation: str | int | None = None,
Expand Down Expand Up @@ -329,9 +328,9 @@ class ContainerCollection(Collection[Container]):
shm_size: str | int | None = None,
stdin_open: bool = False,
stop_signal: str | None = None,
storage_opt: dict[Incomplete, Incomplete] | None = None,
storage_opt: dict[str, str] | None = None,
stream: bool = False,
sysctls: dict[Incomplete, Incomplete] | None = None,
sysctls: dict[str, str] | None = None,
tmpfs: dict[str, str] | None = None,
tty: bool = False,
ulimits: list[Ulimit] | None = None,
Expand All @@ -345,6 +344,7 @@ class ContainerCollection(Collection[Container]):
volumes_from: list[str] | None = None,
working_dir: str | None = None,
) -> Container: ...
@override
def create( # type:ignore[override]
self,
image: str | Image,
Expand All @@ -367,22 +367,22 @@ class ContainerCollection(Collection[Container]):
cpuset_cpus: str | None = None,
cpuset_mems: str | None = None,
detach: bool = False,
device_cgroup_rules: list[Incomplete] | None = None,
device_cgroup_rules: list[str] | None = None,
device_read_bps: list[Mapping[str, str | int]] | None = None,
device_read_iops: list[Mapping[str, str | int]] | None = None,
device_write_bps: list[Mapping[str, str | int]] | None = None,
device_write_iops: list[Mapping[str, str | int]] | None = None,
devices: list[str] | None = None,
device_requests: list[DeviceRequest] | None = None,
dns: list[Incomplete] | None = None,
dns_opt: list[Incomplete] | None = None,
dns_search: list[Incomplete] | None = None,
domainname: str | list[Incomplete] | None = None,
dns: list[str] | None = None,
dns_opt: list[str] | None = None,
dns_search: list[str] | None = None,
domainname: str | list[str] | None = None,
entrypoint: str | list[str] | None = None,
environment: dict[str, str] | list[str] | None = None,
extra_hosts: dict[str, str] | None = None,
group_add: Iterable[str | int] | None = None,
healthcheck: dict[Incomplete, Incomplete] | None = None,
healthcheck: dict[str, Any] | None = None,
hostname: str | None = None,
init: bool | None = None,
init_path: str | None = None,
Expand All @@ -392,7 +392,7 @@ class ContainerCollection(Collection[Container]):
labels: dict[str, str] | list[str] | None = None,
links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None,
log_config: LogConfig | None = None,
lxc_conf: dict[Incomplete, Incomplete] | None = None,
lxc_conf: dict[str, str] | None = None,
mac_address: str | None = None,
mem_limit: str | int | None = None,
mem_reservation: str | int | None = None,
Expand Down Expand Up @@ -420,9 +420,9 @@ class ContainerCollection(Collection[Container]):
shm_size: str | int | None = None,
stdin_open: bool = False,
stop_signal: str | None = None,
storage_opt: dict[Incomplete, Incomplete] | None = None,
storage_opt: dict[str, str] | None = None,
stream: bool = False,
sysctls: dict[Incomplete, Incomplete] | None = None,
sysctls: dict[str, str] | None = None,
tmpfs: dict[str, str] | None = None,
tty: bool = False,
ulimits: list[Ulimit] | None = None,
Expand All @@ -436,22 +436,23 @@ class ContainerCollection(Collection[Container]):
volumes_from: list[str] | None = None,
working_dir: str | None = None,
) -> Container: ...
@override
def get(self, container_id: str) -> Container: ...
def list(
self,
all: bool = False,
before: str | None = None,
filters: dict[str, Incomplete] | None = None,
filters: dict[str, str | list[str] | bool] | None = None,
limit: int = -1,
since: str | None = None,
sparse: bool = False,
ignore_removed: bool = False,
) -> list[Container]: ...
def prune(self, filters: dict[str, Incomplete] | None = None) -> dict[str, Incomplete]: ...
def prune(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ...

RUN_CREATE_KWARGS: list[str]
RUN_HOST_CONFIG_KWARGS: list[str]

class ExecResult(NamedTuple):
exit_code: Incomplete
output: Incomplete
exit_code: int | None
output: bytes | Iterator[bytes]
20 changes: 12 additions & 8 deletions stubs/docker/docker/models/plugins.pyi
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
from _typeshed import Incomplete
from collections.abc import Generator
from typing import Any
from typing_extensions import override

from .resource import Collection, Model

class Plugin(Model):
@property
def name(self): ...
def name(self) -> str | None: ...
@property
def enabled(self): ...
def enabled(self) -> bool | None: ...
@property
def settings(self): ...
def configure(self, options) -> None: ...
def settings(self) -> dict[str, Any] | None: ...
def configure(self, options: dict[str, Any]) -> None: ...
def disable(self, force: bool = False) -> None: ...
def enable(self, timeout: int = 0) -> None: ...
def push(self): ...
def remove(self, force: bool = False): ...
def upgrade(self, remote=None) -> Generator[Incomplete, Incomplete, None]: ...
def push(self) -> Generator[dict[str, Any], None, None]: ...
def remove(self, force: bool = False) -> bool: ...
def upgrade(self, remote: str | None = None) -> Generator[dict[str, Any], None, None]: ...

class PluginCollection(Collection[Plugin]):
model: type[Plugin]
@override
def create(self, name, plugin_data_dir, gzip: bool = False): ... # type:ignore[override]
@override
def get(self, name): ...
def install(self, remote_name, local_name=None): ...
@override
def list(self): ...
13 changes: 13 additions & 0 deletions stubs/docker/docker/transport/basehttpadapter.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
from collections.abc import Mapping
from typing_extensions import override

import requests.adapters
from urllib3.connectionpool import ConnectionPool

class BaseHTTPAdapter(requests.adapters.HTTPAdapter):
@override
def close(self) -> None: ...
@override
def get_connection_with_tls_context(
self,
request: requests.PreparedRequest,
verify: bool | str | None,
proxies: Mapping[str, str] | None = None,
cert: tuple[str, str] | str | None = None,
) -> ConnectionPool: ...
Loading