mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 20:45:49 +08:00
[docker] Fix incomplete types in models and add missing method (#15565)
This commit is contained in:
@@ -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
|
||||
@@ -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,
|
||||
@@ -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],
|
||||
@@ -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(
|
||||
@@ -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: ...
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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]
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user