diff --git a/stubs/docker/@tests/stubtest_allowlist.txt b/stubs/docker/@tests/stubtest_allowlist.txt index 437de1b4009f..224425773c24 100644 --- a/stubs/docker/@tests/stubtest_allowlist.txt +++ b/stubs/docker/@tests/stubtest_allowlist.txt @@ -6,10 +6,8 @@ docker.transport.sshconn # model is always set by child classes docker.models.resource.Collection.model -# keyword arguments are now unsupported -docker.api.container.ContainerApiMixin.start - # implementation has *args and **kwargs params that can't be used +docker.api.container.ContainerApiMixin.start docker.client.DockerClient.info docker.client.DockerClient.ping diff --git a/stubs/docker/docker/api/config.pyi b/stubs/docker/docker/api/config.pyi index 209a0762c53c..df2a281ee813 100644 --- a/stubs/docker/docker/api/config.pyi +++ b/stubs/docker/docker/api/config.pyi @@ -1,5 +1,13 @@ +from _typeshed import Incomplete + class ConfigApiMixin: - def create_config(self, name, data, labels=None, templating=None): ... + def create_config( + self, + name: str, + data: bytes, + labels: dict[Incomplete, Incomplete] | None = None, + templating: dict[Incomplete, Incomplete] | None = None, + ): ... def inspect_config(self, id): ... def remove_config(self, id): ... def configs(self, filters=None): ... diff --git a/stubs/docker/docker/api/container.pyi b/stubs/docker/docker/api/container.pyi index 5fb0a48c87bb..09322cad2948 100644 --- a/stubs/docker/docker/api/container.pyi +++ b/stubs/docker/docker/api/container.pyi @@ -1,12 +1,22 @@ import datetime from _typeshed import Incomplete +from collections.abc import Iterable, Mapping from typing import Any, Literal, TypeAlias, TypedDict, overload, type_check_only +from typing_extensions import NotRequired -from docker._types import WaitContainerResponse +from docker._types import ContainerWeightDevice, WaitContainerResponse +from docker.types.containers import DeviceRequest, LogConfig, Ulimit from docker.types.daemon import CancellableStream +from docker.types.healthcheck import Healthcheck +from docker.types.services import Mount from ..types import ContainerConfig, EndpointConfig, HostConfig, NetworkingConfig +@type_check_only +class _RestartPolicy(TypedDict): + MaximumRetryCount: NotRequired[int] + Name: NotRequired[Literal["always", "on-failure"]] + @type_check_only class _HasId(TypedDict): Id: str @@ -121,11 +131,116 @@ class ContainerApiMixin: use_config_proxy: bool = True, platform: str | None = None, ): ... - def create_container_config(self, *args, **kwargs) -> ContainerConfig: ... + # Please keep in sync with docker.types.ContainerConfig + def create_container_config( + self, + image: str, + command: str | list[str], + hostname: str | None = None, + user: str | int | None = None, + detach: bool = False, + stdin_open: bool = False, + tty: bool = False, + # list is invariant, enumerating all possible union combination would be too complex for: + # list[str | int | tuple[int | str, str] | tuple[int | str, ...]] + ports: dict[str, dict[str, str]] | list[Any] | None = None, + environment: dict[str, str] | list[str] | None = None, + volumes: str | list[str] | None = None, + network_disabled: bool = False, + entrypoint: str | list[str] | None = None, + working_dir: str | None = None, + domainname: str | None = None, + host_config: HostConfig | None = None, + mac_address: str | None = None, + labels: dict[str, str] | list[str] | None = None, + stop_signal: str | None = None, + networking_config: NetworkingConfig | None = None, + healthcheck: Healthcheck | None = None, + stop_timeout: int | None = None, + runtime: str | None = None, + ) -> ContainerConfig: ... def create_container_from_config(self, config, name=None, platform=None): ... - def create_host_config(self, *args, **kwargs) -> HostConfig: ... - def create_networking_config(self, *args, **kwargs) -> NetworkingConfig: ... - def create_endpoint_config(self, *args, **kwargs) -> EndpointConfig: ... + # Please keep in sync with docker.types.HostConfig + def create_host_config( + self, + binds: dict[str, Mapping[str, str]] | list[str] | None = None, + port_bindings: Mapping[int | str, Any] | None = None, # Any: int, str, tuple, dict, or list + lxc_conf: dict[str, str] | list[dict[str, str]] | None = None, + publish_all_ports: bool = False, + links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None, + privileged: bool = False, + dns: list[str] | None = None, + dns_search: list[str] | None = None, + volumes_from: list[str] | None = None, + network_mode: str | None = None, + restart_policy: Mapping[str, str | int] | None = None, + cap_add: list[str] | None = None, + cap_drop: list[str] | None = None, + devices: list[str] | None = None, + extra_hosts: dict[str, str] | list[str] | None = None, + read_only: bool | None = None, + pid_mode: str | None = None, + ipc_mode: str | None = None, + security_opt: list[str] | None = None, + ulimits: list[Ulimit] | None = None, + log_config: LogConfig | None = None, + mem_limit: str | int | None = None, + memswap_limit: str | int | None = None, + mem_reservation: str | int | None = None, + kernel_memory: str | int | None = None, + mem_swappiness: int | None = None, + cgroup_parent: str | None = None, + group_add: Iterable[str | int] | None = None, + cpu_quota: int | None = None, + cpu_period: int | None = None, + blkio_weight: int | None = None, + blkio_weight_device: list[ContainerWeightDevice] | None = None, + device_read_bps: list[Mapping[str, str | int]] | None = None, + device_write_bps: list[Mapping[str, str | int]] | None = None, + device_read_iops: list[Mapping[str, str | int]] | None = None, + device_write_iops: list[Mapping[str, str | int]] | None = None, + oom_kill_disable: bool = False, + shm_size: str | int | None = None, + sysctls: dict[str, str] | None = None, + tmpfs: dict[str, str] | None = None, + oom_score_adj: int | None = None, + dns_opt: list[str] | None = None, + cpu_shares: int | None = None, + cpuset_cpus: str | None = None, + userns_mode: str | None = None, + uts_mode: str | None = None, + pids_limit: int | None = None, + isolation: str | None = None, + auto_remove: bool = False, + storage_opt: dict[str, str] | None = None, + init: bool | None = None, + init_path: str | None = None, + volume_driver: str | None = None, + cpu_count: int | None = None, + cpu_percent: int | None = None, + nano_cpus: int | None = None, + cpuset_mems: str | None = None, + runtime: str | None = None, + mounts: list[Mount] | None = None, + cpu_rt_period: int | None = None, + cpu_rt_runtime: int | None = None, + device_cgroup_rules: list[str] | None = None, + device_requests: list[DeviceRequest] | None = None, + cgroupns: Literal["private", "host"] | None = None, + ) -> HostConfig: ... + # Please keep in sync with docker.types.NetworkingConfig + def create_networking_config(self, endpoints_config: EndpointConfig | None = None) -> NetworkingConfig: ... + # Please keep in sync with docker.types.EndpointConfig + def create_endpoint_config( + self, + aliases: list[str] | None = None, + links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None, + ipv4_address: str | None = None, + ipv6_address: str | None = None, + link_local_ips: list[str] | None = None, + driver_opt: dict[str, str] | None = None, + mac_address: str | None = None, + ) -> EndpointConfig: ... def diff(self, container: _Container) -> list[dict[Incomplete, Incomplete]]: ... def export(self, container: _Container, chunk_size: int | None = 2097152): ... def get_archive( @@ -201,7 +316,7 @@ class ContainerApiMixin: mem_reservation: float | str | None = None, memswap_limit: int | str | None = None, kernel_memory: int | str | None = None, - restart_policy=None, + restart_policy: _RestartPolicy | None = None, ): ... def wait( self, diff --git a/stubs/docker/docker/api/image.pyi b/stubs/docker/docker/api/image.pyi index 4137ee8883ca..565ed904d273 100644 --- a/stubs/docker/docker/api/image.pyi +++ b/stubs/docker/docker/api/image.pyi @@ -38,6 +38,6 @@ class ImageApiMixin: def push(self, repository: str, tag: str | None = None, stream: bool = False, auth_config=None, decode: bool = False): ... def remove_image(self, image: str, force: bool = False, noprune: bool = False): ... def search(self, term: str, limit: int | None = None): ... - def tag(self, image, repository, tag: str | None = None, force: bool = False): ... + def tag(self, image, repository, tag: str | None = None, force: bool = False) -> bool: ... def is_file(src: str) -> bool: ... diff --git a/stubs/docker/docker/api/network.pyi b/stubs/docker/docker/api/network.pyi index 8443762babe2..c6a8cf6b434e 100644 --- a/stubs/docker/docker/api/network.pyi +++ b/stubs/docker/docker/api/network.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from collections.abc import Iterable from typing import Any, Literal, TypeAlias, TypedDict, type_check_only @@ -15,7 +16,7 @@ _Network: TypeAlias = _HasId | _HasID | str _Container: TypeAlias = _HasId | _HasID | str class NetworkApiMixin: - def networks(self, names=None, ids=None, filters=None): ... + def networks(self, names: list[Incomplete] | None = None, ids: list[Incomplete] | None = None, filters=None): ... def create_network( self, name: str, diff --git a/stubs/docker/docker/client.pyi b/stubs/docker/docker/client.pyi index 4ba4bcfce905..9a0eb9194aa1 100644 --- a/stubs/docker/docker/client.pyi +++ b/stubs/docker/docker/client.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete from collections.abc import Iterable, Mapping +from datetime import datetime from typing import Any, Literal, NoReturn, Protocol, overload, type_check_only from docker import APIClient @@ -83,13 +84,28 @@ class DockerClient: @property def volumes(self) -> VolumeCollection: ... + # Please keep in sync with docker.api.daemon.DaemonApiMixin.events @overload - def events(self, *args, decode: Literal[False] | None = None, **kwargs) -> CancellableStream[str]: ... + def events( + self, + since: datetime | int | None = None, + until: datetime | int | None = None, + filters: dict[str, Any] | None = None, + decode: Literal[False] | None = None, + ) -> CancellableStream[str]: ... @overload - def events(self, *args, decode: Literal[True] = ..., **kwargs) -> CancellableStream[dict[str, Any]]: ... + def events( + self, + since: datetime | int | None = None, + until: datetime | int | None = None, + filters: dict[str, Any] | None = None, + decode: Literal[True] = ..., + ) -> CancellableStream[dict[str, Any]]: ... def df(self) -> dict[str, Any]: ... + # Please keep in sync with docker.api.daemon.DaemonApiMixin.info def info(self) -> dict[str, Any]: ... + # Please keep in sync with docker.api.daemon.DaemonApiMixin.login def login( self, username: str, @@ -99,7 +115,9 @@ class DockerClient: reauth: bool = False, dockercfg_path: str | None = None, ) -> dict[str, Any]: ... + # Please keep in sync with docker.api.daemon.DaemonApiMixin.ping def ping(self) -> bool: ... + # Please keep in sync with docker.api.daemon.DaemonApiMixin.version def version(self, api_version: bool = True) -> dict[str, Any]: ... def close(self) -> None: ... def __getattr__(self, name: str) -> NoReturn: ... diff --git a/stubs/docker/docker/models/configs.pyi b/stubs/docker/docker/models/configs.pyi index 3a973f31763e..08a8fe4e6baa 100644 --- a/stubs/docker/docker/models/configs.pyi +++ b/stubs/docker/docker/models/configs.pyi @@ -1,4 +1,5 @@ -import builtins +from _typeshed import Incomplete +from builtins import list as _list from .resource import Collection, Model @@ -10,6 +11,15 @@ class Config(Model): class ConfigCollection(Collection[Config]): model: type[Config] - def create(self, **kwargs) -> Config: ... # type: ignore[override] + # Please keep in sync with docker.api.config.ConfigApiMixin.create_config + def create( # type: ignore[override] + self, + *, + name: str, + data: bytes, + labels: dict[Incomplete, Incomplete] | None = None, + templating: dict[Incomplete, Incomplete] | None = None, + ) -> Config: ... def get(self, config_id: str) -> Config: ... - def list(self, **kwargs) -> builtins.list[Config]: ... + # Please keep in sync with docker.api.config.ConfigApiMixin.configs + def list(self, *, filters=None) -> _list[Config]: ... diff --git a/stubs/docker/docker/models/containers.pyi b/stubs/docker/docker/models/containers.pyi index 14a9505d908b..2a89fa402d89 100644 --- a/stubs/docker/docker/models/containers.pyi +++ b/stubs/docker/docker/models/containers.pyi @@ -1,12 +1,12 @@ -import builtins import datetime from _io import _BufferedReaderStream +from builtins import list as _list from collections.abc import Iterable, Iterator, Mapping from socket import SocketIO -from typing import Any, Literal, NamedTuple, TypedDict, overload, type_check_only -from typing_extensions import NotRequired +from typing import Any, Literal, NamedTuple, overload from docker._types import ContainerWeightDevice, WaitContainerResponse +from docker.api.container import _RestartPolicy, _TopResult from docker.transport.sshconn import SSHSocket from docker.types import EndpointConfig from docker.types.containers import DeviceRequest, LogConfig, Ulimit @@ -16,16 +16,6 @@ from docker.types.services import Mount from .images import Image from .resource import Collection, Model -@type_check_only -class _RestartPolicy(TypedDict): - MaximumRetryCount: NotRequired[int] - Name: NotRequired[Literal["always", "on-failure"]] - -@type_check_only -class _TopResult(TypedDict): - Titles: list[str] - Processes: list[list[str]] - class Container(Model): @property def name(self) -> str | None: ... @@ -40,6 +30,7 @@ class Container(Model): @property def ports(self) -> dict[str, list[dict[str, str]] | None]: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.attach @overload def attach( self, @@ -75,8 +66,20 @@ class Container(Model): self, *, stdout: bool = True, stderr: bool = True, stream: Literal[True], logs: bool = False, demux: Literal[True] ) -> 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: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.attach_socket + def attach_socket(self, *, params=None, ws: bool = False) -> SocketIO | _BufferedReaderStream | SSHSocket: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.commit + def commit( + self, + repository: str | None = None, + tag: str | None = None, + *, + message=None, + author=None, + pause: bool = True, + changes=None, + conf=None, + ) -> Image: ... def diff(self) -> list[dict[str, int | str]]: ... def exec_run( self, @@ -100,6 +103,7 @@ class Container(Model): ) -> tuple[Iterator[bytes], dict[str, Any] | None]: ... def kill(self, signal: str | int | None = None) -> None: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.logs @overload def logs( self, @@ -129,15 +133,24 @@ class Container(Model): def pause(self) -> None: ... def put_archive(self, path: str, data) -> bool: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.remove_container def remove(self, *, v: bool = False, link: bool = False, force: bool = False) -> None: ... def rename(self, name: str) -> None: ... def resize(self, height: int, width: int) -> None: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.restart def restart(self, *, timeout: float | None = 10) -> None: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.start def start(self) -> None: ... - def stats(self, **kwargs) -> Iterator[dict[str, Any]] | dict[str, Any]: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.stats + def stats( + self, *, decode: bool | None = None, stream: bool = True, one_shot: bool | None = None + ) -> Iterator[dict[str, Any]] | dict[str, Any]: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.stop def stop(self, *, timeout: float | None = None) -> None: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.top def top(self, *, ps_args: str | None = None) -> _TopResult: ... def unpause(self) -> None: ... + # Please keep in sync with docker.api.container.ContainerApiMixin.update_container def update( self, *, @@ -153,6 +166,7 @@ class Container(Model): kernel_memory: int | str | None = None, restart_policy: _RestartPolicy | None = None, ): ... + # Please keep in sync with docker.api.container.ContainerApiMixin.wait def wait( self, *, timeout: float | None = None, condition: Literal["not-running", "next-exit", "removed"] | None = None ) -> WaitContainerResponse: ... @@ -164,16 +178,16 @@ class ContainerCollection(Collection[Container]): def run( self, image: str | Image, - command: str | builtins.list[str] | None = None, + command: str | _list[str] | None = None, stdout: bool = True, stderr: bool = False, remove: bool = False, *, auto_remove: bool = False, - blkio_weight_device: builtins.list[ContainerWeightDevice] | None = None, + blkio_weight_device: _list[ContainerWeightDevice] | None = None, blkio_weight: int | None = None, - cap_add: builtins.list[str] | None = None, - cap_drop: builtins.list[str] | None = None, + cap_add: _list[str] | None = None, + cap_drop: _list[str] | None = None, cgroup_parent: str | None = None, cgroupns: Literal["private", "host"] | None = None, cpu_count: int | None = None, @@ -186,19 +200,19 @@ class ContainerCollection(Collection[Container]): cpuset_cpus: str | None = None, cpuset_mems: str | None = None, detach: Literal[False] = False, - device_cgroup_rules: builtins.list[str] | None = None, - device_read_bps: builtins.list[Mapping[str, str | int]] | None = None, - device_read_iops: builtins.list[Mapping[str, str | int]] | None = None, - device_write_bps: builtins.list[Mapping[str, str | int]] | None = None, - device_write_iops: builtins.list[Mapping[str, str | int]] | None = None, - devices: builtins.list[str] | None = None, - device_requests: builtins.list[DeviceRequest] | None = None, - dns: builtins.list[str] | None = None, - dns_opt: builtins.list[str] | None = None, - dns_search: builtins.list[str] | None = None, - domainname: str | builtins.list[str] | None = None, - entrypoint: str | builtins.list[str] | None = None, - environment: dict[str, str] | builtins.list[str] | 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[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[str, Any] | None = None, @@ -208,7 +222,7 @@ class ContainerCollection(Collection[Container]): ipc_mode: str | None = None, isolation: str | None = None, kernel_memory: str | int | None = None, - labels: dict[str, str] | builtins.list[str] | None = None, + 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[str, str] | None = None, @@ -217,7 +231,7 @@ class ContainerCollection(Collection[Container]): mem_reservation: str | int | None = None, mem_swappiness: int | None = None, memswap_limit: str | int | None = None, - mounts: builtins.list[Mount] | None = None, + mounts: _list[Mount] | None = None, name: str | None = None, nano_cpus: int | None = None, network: str | None = None, @@ -229,13 +243,13 @@ class ContainerCollection(Collection[Container]): pid_mode: str | None = None, pids_limit: int | None = None, platform: str | None = None, - ports: Mapping[str, int | builtins.list[int] | tuple[str, int] | None] | None = None, + ports: Mapping[str, int | _list[int] | tuple[str, int] | None] | None = None, privileged: bool = False, publish_all_ports: bool = False, read_only: bool | None = None, restart_policy: _RestartPolicy | None = None, runtime: str | None = None, - security_opt: builtins.list[str] | None = None, + security_opt: _list[str] | None = None, shm_size: str | int | None = None, stdin_open: bool = False, stop_signal: str | None = None, @@ -244,31 +258,31 @@ class ContainerCollection(Collection[Container]): sysctls: dict[str, str] | None = None, tmpfs: dict[str, str] | None = None, tty: bool = False, - ulimits: builtins.list[Ulimit] | None = None, + ulimits: _list[Ulimit] | None = None, use_config_proxy: bool | None = None, user: str | int | None = None, userns_mode: str | None = None, uts_mode: str | None = None, version: str | None = None, volume_driver: str | None = None, - volumes: dict[str, dict[str, str]] | builtins.list[str] | None = None, - volumes_from: builtins.list[str] | None = None, + volumes: dict[str, dict[str, str]] | _list[str] | None = None, + volumes_from: _list[str] | None = None, working_dir: str | None = None, ) -> bytes: ... # TODO: This should return a stream, if `stream` is True @overload def run( self, image: str | Image, - command: str | builtins.list[str] | None = None, + command: str | _list[str] | None = None, stdout: bool = True, stderr: bool = False, remove: bool = False, *, auto_remove: bool = False, - blkio_weight_device: builtins.list[ContainerWeightDevice] | None = None, + blkio_weight_device: _list[ContainerWeightDevice] | None = None, blkio_weight: int | None = None, - cap_add: builtins.list[str] | None = None, - cap_drop: builtins.list[str] | None = None, + cap_add: _list[str] | None = None, + cap_drop: _list[str] | None = None, cgroup_parent: str | None = None, cgroupns: Literal["private", "host"] | None = None, cpu_count: int | None = None, @@ -281,19 +295,19 @@ class ContainerCollection(Collection[Container]): cpuset_cpus: str | None = None, cpuset_mems: str | None = None, detach: Literal[True], - device_cgroup_rules: builtins.list[str] | None = None, - device_read_bps: builtins.list[Mapping[str, str | int]] | None = None, - device_read_iops: builtins.list[Mapping[str, str | int]] | None = None, - device_write_bps: builtins.list[Mapping[str, str | int]] | None = None, - device_write_iops: builtins.list[Mapping[str, str | int]] | None = None, - devices: builtins.list[str] | None = None, - device_requests: builtins.list[DeviceRequest] | None = None, - dns: builtins.list[str] | None = None, - dns_opt: builtins.list[str] | None = None, - dns_search: builtins.list[str] | None = None, - domainname: str | builtins.list[str] | None = None, - entrypoint: str | builtins.list[str] | None = None, - environment: dict[str, str] | builtins.list[str] | 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[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[str, Any] | None = None, @@ -303,7 +317,7 @@ class ContainerCollection(Collection[Container]): ipc_mode: str | None = None, isolation: str | None = None, kernel_memory: str | int | None = None, - labels: dict[str, str] | builtins.list[str] | None = None, + 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[str, str] | None = None, @@ -312,7 +326,7 @@ class ContainerCollection(Collection[Container]): mem_reservation: str | int | None = None, mem_swappiness: int | None = None, memswap_limit: str | int | None = None, - mounts: builtins.list[Mount] | None = None, + mounts: _list[Mount] | None = None, name: str | None = None, nano_cpus: int | None = None, network: str | None = None, @@ -324,13 +338,13 @@ class ContainerCollection(Collection[Container]): pid_mode: str | None = None, pids_limit: int | None = None, platform: str | None = None, - ports: Mapping[str, int | builtins.list[int] | tuple[str, int] | None] | None = None, + ports: Mapping[str, int | _list[int] | tuple[str, int] | None] | None = None, privileged: bool = False, publish_all_ports: bool = False, read_only: bool | None = None, restart_policy: _RestartPolicy | None = None, runtime: str | None = None, - security_opt: builtins.list[str] | None = None, + security_opt: _list[str] | None = None, shm_size: str | int | None = None, stdin_open: bool = False, stop_signal: str | None = None, @@ -339,28 +353,28 @@ class ContainerCollection(Collection[Container]): sysctls: dict[str, str] | None = None, tmpfs: dict[str, str] | None = None, tty: bool = False, - ulimits: builtins.list[Ulimit] | None = None, + ulimits: _list[Ulimit] | None = None, use_config_proxy: bool | None = None, user: str | int | None = None, userns_mode: str | None = None, uts_mode: str | None = None, version: str | None = None, volume_driver: str | None = None, - volumes: dict[str, dict[str, str]] | builtins.list[str] | None = None, - volumes_from: builtins.list[str] | None = None, + volumes: dict[str, dict[str, str]] | _list[str] | None = None, + volumes_from: _list[str] | None = None, working_dir: str | None = None, ) -> Container: ... def create( # type: ignore[override] self, image: str | Image, - command: str | builtins.list[str] | None = None, + command: str | _list[str] | None = None, *, auto_remove: bool = False, - blkio_weight_device: builtins.list[ContainerWeightDevice] | None = None, + blkio_weight_device: _list[ContainerWeightDevice] | None = None, blkio_weight: int | None = None, - cap_add: builtins.list[str] | None = None, - cap_drop: builtins.list[str] | None = None, + cap_add: _list[str] | None = None, + cap_drop: _list[str] | None = None, cgroup_parent: str | None = None, cgroupns: Literal["private", "host"] | None = None, cpu_count: int | None = None, @@ -373,19 +387,19 @@ class ContainerCollection(Collection[Container]): cpuset_cpus: str | None = None, cpuset_mems: str | None = None, detach: bool = False, - device_cgroup_rules: builtins.list[str] | None = None, - device_read_bps: builtins.list[Mapping[str, str | int]] | None = None, - device_read_iops: builtins.list[Mapping[str, str | int]] | None = None, - device_write_bps: builtins.list[Mapping[str, str | int]] | None = None, - device_write_iops: builtins.list[Mapping[str, str | int]] | None = None, - devices: builtins.list[str] | None = None, - device_requests: builtins.list[DeviceRequest] | None = None, - dns: builtins.list[str] | None = None, - dns_opt: builtins.list[str] | None = None, - dns_search: builtins.list[str] | None = None, - domainname: str | builtins.list[str] | None = None, - entrypoint: str | builtins.list[str] | None = None, - environment: dict[str, str] | builtins.list[str] | 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[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[str, Any] | None = None, @@ -395,7 +409,7 @@ class ContainerCollection(Collection[Container]): ipc_mode: str | None = None, isolation: str | None = None, kernel_memory: str | int | None = None, - labels: dict[str, str] | builtins.list[str] | None = None, + 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[str, str] | None = None, @@ -404,7 +418,7 @@ class ContainerCollection(Collection[Container]): mem_reservation: str | int | None = None, mem_swappiness: int | None = None, memswap_limit: str | int | None = None, - mounts: builtins.list[Mount] | None = None, + mounts: _list[Mount] | None = None, name: str | None = None, nano_cpus: int | None = None, network: str | None = None, @@ -416,13 +430,13 @@ class ContainerCollection(Collection[Container]): pid_mode: str | None = None, pids_limit: int | None = None, platform: str | None = None, - ports: Mapping[str, int | builtins.list[int] | tuple[str, int] | None] | None = None, + ports: Mapping[str, int | _list[int] | tuple[str, int] | None] | None = None, privileged: bool = False, publish_all_ports: bool = False, read_only: bool | None = None, restart_policy: _RestartPolicy | None = None, runtime: str | None = None, - security_opt: builtins.list[str] | None = None, + security_opt: _list[str] | None = None, shm_size: str | int | None = None, stdin_open: bool = False, stop_signal: str | None = None, @@ -431,15 +445,15 @@ class ContainerCollection(Collection[Container]): sysctls: dict[str, str] | None = None, tmpfs: dict[str, str] | None = None, tty: bool = False, - ulimits: builtins.list[Ulimit] | None = None, + ulimits: _list[Ulimit] | None = None, use_config_proxy: bool | None = None, user: str | int | None = None, userns_mode: str | None = None, uts_mode: str | None = None, version: str | None = None, volume_driver: str | None = None, - volumes: dict[str, dict[str, str]] | builtins.list[str] | None = None, - volumes_from: builtins.list[str] | None = None, + volumes: dict[str, dict[str, str]] | _list[str] | None = None, + volumes_from: _list[str] | None = None, working_dir: str | None = None, ) -> Container: ... def get(self, container_id: str) -> Container: ... @@ -447,12 +461,12 @@ class ContainerCollection(Collection[Container]): self, all: bool = False, before: str | None = None, - filters: dict[str, str | builtins.list[str] | bool] | 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, - ) -> builtins.list[Container]: ... + ) -> _list[Container]: ... def prune(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ... RUN_CREATE_KWARGS: list[str] diff --git a/stubs/docker/docker/models/images.pyi b/stubs/docker/docker/models/images.pyi index 7f42c3fa8460..db5b7954ca3e 100644 --- a/stubs/docker/docker/models/images.pyi +++ b/stubs/docker/docker/models/images.pyi @@ -1,15 +1,14 @@ -import builtins -from _typeshed import SupportsRead +from _typeshed import Incomplete, SupportsRead +from builtins import list as _list from collections.abc import Iterator from io import StringIO -from typing import IO, Any, Literal, TypeAlias, TypedDict, overload, type_check_only +from typing import IO, Any, Literal, TypedDict, overload, type_check_only from docker._types import JSON +from docker.api.build import _Filers from .resource import Collection, Model -_ImageList: TypeAlias = list[Image] # To resolve conflicts with a method called "list" - @type_check_only class _ContainerLimits(TypedDict, total=False): memory: int @@ -27,11 +26,13 @@ class Image(Model): def history(self) -> list[Any]: ... def remove(self, force: bool = False, noprune: bool = False) -> dict[str, Any]: ... def save(self, chunk_size: int = 2097152, named: str | bool = False) -> Iterator[Any]: ... - def tag(self, repository: str, tag: str | None = None, **kwargs) -> bool: ... + # Please keep in sync with docker.api.image.ImageApiMixin.tag + def tag(self, repository: str, tag: str | None = None, *, force: bool = False) -> bool: ... class RegistryData(Model): image_name: str - def __init__(self, image_name: str, *args, **kwargs) -> None: ... + # Please keep in sync with docker.models.resource.Model.__init__ + def __init__(self, image_name: str, attrs=None, client=None, collection=None) -> None: ... @property def id(self) -> str: ... @property @@ -42,13 +43,14 @@ class RegistryData(Model): class ImageCollection(Collection[Image]): model: type[Image] + # Please keep in sync with docker.api.build.BuildApiMixin.build def build( self, *, path: str | None = None, - fileobj: StringIO | IO[bytes] | None = None, tag: str | None = None, quiet: bool = False, + fileobj: StringIO | IO[bytes] | None = None, nocache: bool = False, rm: bool = False, timeout: int | None = None, @@ -57,25 +59,28 @@ class ImageCollection(Collection[Image]): pull: bool = False, forcerm: bool = False, dockerfile: str | None = None, - buildargs: dict[str, Any] | None = None, container_limits: _ContainerLimits | None = None, + decode: bool = False, + buildargs: dict[str, Any] | None = None, + gzip: bool = False, shmsize: int | None = None, labels: dict[str, Any] | None = None, # need to use list, because the type must be json serializable - cache_from: builtins.list[str] | None = None, + cache_from: _list[str] | None = None, target: str | None = None, network_mode: str | None = None, squash: bool | None = None, - extra_hosts: builtins.list[str] | dict[str, str] | None = None, + extra_hosts: _list[str] | dict[str, str] | None = None, platform: str | None = None, isolation: str | None = None, use_config_proxy: bool = True, ) -> tuple[Image, Iterator[JSON]]: ... def get(self, name: str) -> Image: ... def get_registry_data(self, name, auth_config: dict[str, Any] | None = None) -> RegistryData: ... - def list(self, name: str | None = None, all: bool = False, filters: dict[str, Any] | None = None) -> _ImageList: ... - def load(self, data: bytes | SupportsRead[bytes]) -> _ImageList: ... + def list(self, name: str | None = None, all: bool = False, filters: dict[str, Any] | None = None) -> _list[Image]: ... + def load(self, data: bytes | SupportsRead[bytes]) -> _list[Image]: ... + # Please keep in sync with docker.api.image.ImageApiMixin.pull @overload def pull( self, @@ -95,7 +100,7 @@ class ImageCollection(Collection[Image]): all_tags: Literal[True], auth_config: dict[str, Any] | None = None, platform: str | None = None, - ) -> _ImageList: ... + ) -> _list[Image]: ... @overload def pull( self, @@ -105,12 +110,18 @@ class ImageCollection(Collection[Image]): *, auth_config: dict[str, Any] | None = None, platform: str | None = None, - ) -> _ImageList: ... + ) -> _list[Image]: ... - def push(self, repository: str, tag: str | None = None, **kwargs): ... - def remove(self, *args, **kwargs) -> None: ... - def search(self, *args, **kwargs): ... + # Please keep in sync with docker.api.image.ImageApiMixin.push + def push(self, repository: str, tag: str | None = None, *, stream: bool = False, auth_config=None, decode: bool = False): ... + # Please keep in sync with docker.api.image.ImageApiMixin.remove_image + def remove(self, image: str, force: bool = False, noprune: bool = False) -> None: ... + # Please keep in sync with docker.api.image.ImageApiMixin.search + def search(self, term: str, limit: int | None = None): ... def prune(self, filters: dict[str, Any] | None = None): ... - def prune_builds(self, *args, **kwargs): ... + # Please keep in sync with docker.api.build.BuildApiMixin.prune_builds + def prune_builds( + self, filters: _Filers | None = None, keep_storage: int | None = None, all: bool | None = None + ) -> dict[str, Incomplete]: ... def normalize_platform(platform, engine_info): ... diff --git a/stubs/docker/docker/models/networks.pyi b/stubs/docker/docker/models/networks.pyi index 68a31333d99a..d1679aa9f397 100644 --- a/stubs/docker/docker/models/networks.pyi +++ b/stubs/docker/docker/models/networks.pyi @@ -1,4 +1,6 @@ -import builtins +from _typeshed import Incomplete +from builtins import list as _list +from collections.abc import Iterable from typing import Any, Literal from docker.types import IPAMConfig @@ -11,12 +13,25 @@ class Network(Model): def name(self) -> str | None: ... @property def containers(self) -> list[Container]: ... - def connect(self, container: str | Container, *args, **kwargs) -> None: ... + # Please keep in sync with docker.api.network.NetworkApiMixin.connect_container_to_network + def connect( + self, + container: str | Container, + ipv4_address=None, + ipv6_address=None, + aliases=None, + links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None, + link_local_ips=None, + driver_opt=None, + mac_address=None, + ) -> None: ... + # Please keep in sync with docker.api.network.NetworkApiMixin.disconnect_container_from_network def disconnect(self, container: str | Container, force: bool = False) -> None: ... def remove(self) -> None: ... class NetworkCollection(Collection[Network]): model: type[Network] + # Please keep in sync with docker.api.network.NetworkApiMixin.create_network def create( # type: ignore[override] self, name: str, @@ -31,8 +46,12 @@ class NetworkCollection(Collection[Network]): scope: Literal["local", "global", "swarm"] | None = None, ingress: bool | None = None, ) -> Network: ... - def get( + # Please keep in sync with docker.api.network.NetworkApiMixin.inspect_network + def get( # type: ignore[override] self, network_id: str, verbose: bool | None = None, scope: Literal["local", "global", "swarm"] | None = None - ) -> Network: ... # type: ignore[override] - def list(self, *args, **kwargs) -> builtins.list[Network]: ... - def prune(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ... + ) -> Network: ... + # Please keep in sync with docker.api.network.NetworkApiMixin.networks + def list( + self, names: _list[Incomplete] | None = None, ids: _list[Incomplete] | None = None, filters=None, *, greedy: bool = False + ) -> _list[Network]: ... + def prune(self, filters: dict[str, Incomplete] | None = None) -> dict[str, Any]: ... diff --git a/stubs/docker/docker/models/nodes.pyi b/stubs/docker/docker/models/nodes.pyi index 2292d9243142..e738c9f33bd0 100644 --- a/stubs/docker/docker/models/nodes.pyi +++ b/stubs/docker/docker/models/nodes.pyi @@ -1,3 +1,6 @@ +from builtins import list as _list +from typing import Any + from .resource import Collection, Model class Node(Model): @@ -10,4 +13,5 @@ class Node(Model): class NodeCollection(Collection[Node]): model: type[Node] def get(self, node_id): ... - def list(self, *args, **kwargs): ... + # Please keep in sync with docker.api.swarm.SwarmApiMixin.nodes + def list(self, filters: dict[str, Any] | None = None) -> _list[Node]: ... # Any: filter values + Node response diff --git a/stubs/docker/docker/models/plugins.pyi b/stubs/docker/docker/models/plugins.pyi index 3efb68272eae..68c672edd038 100644 --- a/stubs/docker/docker/models/plugins.pyi +++ b/stubs/docker/docker/models/plugins.pyi @@ -1,3 +1,4 @@ +from builtins import list as _list from collections.abc import Generator from typing import Any @@ -22,4 +23,4 @@ class PluginCollection(Collection[Plugin]): def create(self, name, plugin_data_dir, gzip: bool = False): ... # type: ignore[override] def get(self, name): ... def install(self, remote_name, local_name=None): ... - def list(self): ... + def list(self) -> _list[Plugin]: ... diff --git a/stubs/docker/docker/models/resource.pyi b/stubs/docker/docker/models/resource.pyi index 1d739c5fe4a1..20b153c173e3 100644 --- a/stubs/docker/docker/models/resource.pyi +++ b/stubs/docker/docker/models/resource.pyi @@ -1,4 +1,4 @@ -import builtins +from builtins import list as _list from typing import Any, Generic, NoReturn, TypeVar from typing_extensions import Self @@ -27,7 +27,7 @@ class Collection(Generic[_T]): client: DockerClient def __init__(self, client: DockerClient | None = None) -> None: ... def __call__(self, *args, **kwargs) -> NoReturn: ... - def list(self) -> builtins.list[_T]: ... + def list(self) -> _list[_T]: ... def get(self, key: str) -> _T: ... def create(self, attrs: Any | None = None) -> _T: ... def prepare_model(self, attrs: Model | dict[str, Any]) -> _T: ... diff --git a/stubs/docker/docker/models/secrets.pyi b/stubs/docker/docker/models/secrets.pyi index 802e58ffc796..b511220b6cdd 100644 --- a/stubs/docker/docker/models/secrets.pyi +++ b/stubs/docker/docker/models/secrets.pyi @@ -1,3 +1,8 @@ +from _typeshed import Incomplete +from builtins import list as _list + +from docker.types import DriverConfig + from .resource import Collection, Model class Secret(Model): @@ -8,6 +13,10 @@ class Secret(Model): class SecretCollection(Collection[Secret]): model: type[Secret] - def create(self, **kwargs): ... # type: ignore[override] - def get(self, secret_id): ... - def list(self, **kwargs): ... + # Please keep in sync with docker.api.secret.SecretApiMixin.create_secret + def create( # type: ignore[override] + self, *, name: str, data: bytes, labels: dict[str, Incomplete] | None = None, driver: DriverConfig | None = None + ): ... + def get(self, secret_id: str): ... + # Please keep in sync with docker.api.secret.SecretApiMixin.secrets + def list(self, *, filters: dict[str, Incomplete] | None = None) -> _list[Secret]: ... diff --git a/stubs/docker/docker/models/services.pyi b/stubs/docker/docker/models/services.pyi index 62e3d7c4d1f0..1dc00693427e 100644 --- a/stubs/docker/docker/models/services.pyi +++ b/stubs/docker/docker/models/services.pyi @@ -1,3 +1,5 @@ +from builtins import list as _list + from .resource import Collection, Model class Service(Model): @@ -9,15 +11,27 @@ class Service(Model): def remove(self): ... def tasks(self, filters=None): ... def update(self, **kwargs): ... - def logs(self, **kwargs): ... - def scale(self, replicas): ... + # Please keep in sync with docker.api.service.ServiceApiMixin.service_logs + def logs( + self, + *, + details: bool = False, + follow: bool = False, + stdout: bool = False, + stderr: bool = False, + since: int = 0, + timestamps: bool = False, + tail: str = "all", + ): ... + def scale(self, replicas: int | None): ... def force_update(self): ... class ServiceCollection(Collection[Service]): model: type[Service] def create(self, image, command=None, **kwargs): ... # type: ignore[override] def get(self, service_id, insert_defaults=None): ... - def list(self, **kwargs): ... + # Please keep in sync with docker.api.service.ServiceApiMixin.services + def list(self, *, filters=None, status=None) -> _list[Service]: ... CONTAINER_SPEC_KWARGS: list[str] TASK_TEMPLATE_KWARGS: list[str] diff --git a/stubs/docker/docker/models/swarm.pyi b/stubs/docker/docker/models/swarm.pyi index 6238c6c96e57..f8a5dd9f9934 100644 --- a/stubs/docker/docker/models/swarm.pyi +++ b/stubs/docker/docker/models/swarm.pyi @@ -1,11 +1,13 @@ from collections.abc import Iterable from typing import Any +from docker.types.services import DriverConfig +from docker.types.swarm import SwarmExternalCA + from .resource import Model class Swarm(Model): id_attribute: str - def __init__(self, *args, **kwargs) -> None: ... @property def version(self) -> str | None: ... def get_unlock_key(self) -> dict[str, Any]: ... @@ -18,10 +20,36 @@ class Swarm(Model): subnet_size: int | None = None, data_path_addr: str | None = None, data_path_port: int | None = None, - **kwargs, + *, # Please keep in sync with docker.api.swarm.SwarmApiMixin.create_swarm_spec + task_history_retention_limit: int | None = None, + snapshot_interval: int | None = None, + keep_old_snapshots: int | None = None, + log_entries_for_slow_followers: int | None = None, + heartbeat_tick: int | None = None, + election_tick: int | None = None, + dispatcher_heartbeat_period: int | None = None, + node_cert_expiry: int | None = None, + external_ca: SwarmExternalCA | None = None, + external_cas: list[SwarmExternalCA] | None = None, + name: str | None = None, + labels: dict[str, str] | None = None, + signing_ca_cert: str | None = None, + signing_ca_key: str | None = None, + ca_force_rotate: int | None = None, + autolock_managers: bool | None = None, + log_driver: DriverConfig | None = None, ) -> str: ... - def join(self, *args, **kwargs) -> bool: ... - def leave(self, *args, **kwargs) -> bool: ... + # Please keep in sync with docker.api.swarm.SwarmApiMixin.join_swarm + def join( + self, + remote_addrs: list[str], + join_token: str, + listen_addr: str = "0.0.0.0:2377", + advertise_addr: str | None = None, + data_path_addr: str | None = None, + ) -> bool: ... + # Please keep in sync with docker.api.swarm.SwarmApiMixin.leave_swarm + def leave(self, force: bool = False) -> bool: ... def reload(self) -> None: ... def unlock(self, key: str) -> bool: ... def update( @@ -29,5 +57,22 @@ class Swarm(Model): rotate_worker_token: bool = False, rotate_manager_token: bool = False, rotate_manager_unlock_key: bool = False, - **kwargs, + *, # Please keep in sync with docker.api.swarm.SwarmApiMixin.create_swarm_spec + task_history_retention_limit: int | None = None, + snapshot_interval: int | None = None, + keep_old_snapshots: int | None = None, + log_entries_for_slow_followers: int | None = None, + heartbeat_tick: int | None = None, + election_tick: int | None = None, + dispatcher_heartbeat_period: int | None = None, + node_cert_expiry: int | None = None, + external_ca: SwarmExternalCA | None = None, + external_cas: list[SwarmExternalCA] | None = None, + name: str | None = None, + labels: dict[str, str] | None = None, + signing_ca_cert: str | None = None, + signing_ca_key: str | None = None, + ca_force_rotate: int | None = None, + autolock_managers: bool | None = None, + log_driver: DriverConfig | None = None, ) -> bool: ... diff --git a/stubs/docker/docker/models/volumes.pyi b/stubs/docker/docker/models/volumes.pyi index 2226dc844130..b33cfb30557c 100644 --- a/stubs/docker/docker/models/volumes.pyi +++ b/stubs/docker/docker/models/volumes.pyi @@ -1,4 +1,4 @@ -import builtins +from builtins import list as _list from typing import Any from .resource import Collection, Model @@ -11,7 +11,16 @@ class Volume(Model): class VolumeCollection(Collection[Volume]): model: type[Volume] - def create(self, name: str | None = None, **kwargs) -> Volume: ... # type: ignore[override] + # Please keep in sync with docker.api.volume.VolumeApiMixin.create_volume + def create( # type: ignore[override] + self, + name: str | None = None, + *, + driver: str | None = None, + driver_opts: dict[str, Any] | None = None, + labels: dict[str, Any] | None = None, + ) -> Volume: ... def get(self, volume_id: str) -> Volume: ... - def list(self, **kwargs) -> builtins.list[Volume]: ... + # Please keep in sync with docker.api.volume.VolumeApiMixin.create_volume + def list(self, *, filters: dict[str, Any] | None = None) -> _list[Volume]: ... def prune(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ... diff --git a/stubs/docker/docker/types/containers.pyi b/stubs/docker/docker/types/containers.pyi index 0c9c177e30b5..98b38ffc069e 100644 --- a/stubs/docker/docker/types/containers.pyi +++ b/stubs/docker/docker/types/containers.pyi @@ -20,9 +20,7 @@ class LogConfigTypesEnum: class LogConfig(DictType[Any]): types: builtins.type[LogConfigTypesEnum] - def __init__( - self, *, type: str = ..., Type: str = ..., config: dict[str, str] = ..., Config: dict[str, str] = ... - ) -> None: ... + def __init__(self, *, type: str = ..., Type: str = ..., config: dict[str, str] = {}, Config: dict[str, str] = {}) -> None: ... @property def type(self) -> str: ... diff --git a/stubs/docker/docker/types/healthcheck.pyi b/stubs/docker/docker/types/healthcheck.pyi index 25d3a25439ed..c113c3fb2b28 100644 --- a/stubs/docker/docker/types/healthcheck.pyi +++ b/stubs/docker/docker/types/healthcheck.pyi @@ -6,16 +6,16 @@ class Healthcheck(DictType[Any]): def __init__( self, *, - test: str | list[str] | None = ..., - Test: str | list[str] | None = ..., - interval: int | None = ..., - Interval: int | None = ..., - timeout: int | None = ..., - Timeout: int | None = ..., - retries: int | None = ..., - Retries: int | None = ..., - start_period: int | None = ..., - StartPeriod: int | None = ..., + test: str | list[str] | None = None, + Test: str | list[str] | None = None, + interval: int | None = None, + Interval: int | None = None, + timeout: int | None = None, + Timeout: int | None = None, + retries: int | None = None, + Retries: int | None = None, + start_period: int | None = None, + StartPeriod: int | None = None, ) -> None: ... @property diff --git a/stubs/docker/docker/utils/utils.pyi b/stubs/docker/docker/utils/utils.pyi index 406a48aa8ba5..07333ef59ac5 100644 --- a/stubs/docker/docker/utils/utils.pyi +++ b/stubs/docker/docker/utils/utils.pyi @@ -1,5 +1,5 @@ import datetime -from _typeshed import FileDescriptorOrPath, ReadableBuffer +from _typeshed import FileDescriptorOrPath, ReadableBuffer, Unused from collections.abc import Iterable, Mapping from shlex import _ShlexInstream from typing import Literal, NamedTuple, NoReturn, TypedDict, TypeVar, overload, type_check_only @@ -25,9 +25,9 @@ class URLComponents(NamedTuple): fragment: str | None @deprecated("utils.create_ipam_pool has been removed. Please use a docker.types.IPAMPool object instead.") -def create_ipam_pool(*args, **kwargs) -> NoReturn: ... +def create_ipam_pool(*args: Unused, **kwargs: Unused) -> NoReturn: ... @deprecated("utils.create_ipam_config has been removed. Please use a docker.types.IPAMConfig object instead.") -def create_ipam_config(*args, **kwargs) -> NoReturn: ... +def create_ipam_config(*args: Unused, **kwargs: Unused) -> NoReturn: ... def decode_json_header(header: str | ReadableBuffer): ... def compare_version(v1: str, v2: str) -> Literal[0, -1, 1]: ... def version_lt(v1: str, v2: str) -> bool: ... @@ -75,4 +75,4 @@ def format_extra_hosts( extra_hosts: Mapping[object, object], task: bool = False # keys and values are converted to str ) -> list[str]: ... @deprecated("utils.create_host_config has been removed. Please use a docker.types.HostConfig object instead.") -def create_host_config(self, *args, **kwargs) -> NoReturn: ... +def create_host_config(self, *args: Unused, **kwargs: Unused) -> NoReturn: ... diff --git a/stubs/docker/docker/version.pyi b/stubs/docker/docker/version.pyi index bda5b5a7f4cc..c5dd95466063 100644 --- a/stubs/docker/docker/version.pyi +++ b/stubs/docker/docker/version.pyi @@ -1 +1,3 @@ -__version__: str +from typing import Final + +__version__: Final[str]