diff --git a/stubs/docker/docker/context/context.pyi b/stubs/docker/docker/context/context.pyi index 1013d0201204..cffd95233e08 100644 --- a/stubs/docker/docker/context/context.pyi +++ b/stubs/docker/docker/context/context.pyi @@ -1,5 +1,6 @@ -from collections.abc import Mapping -from typing import Any, TypedDict, type_check_only +from typing import TypedDict, type_check_only + +from docker.tls import TLSConfig as _TLSConfig @type_check_only class _StorageData(TypedDict): @@ -14,9 +15,10 @@ class _Storage(TypedDict): class _Endpoint(TypedDict, total=False): Host: str SkipTLSVerify: bool + DefaultNamespace: str @type_check_only -class _TLSMaterial: +class _TLSMaterial(TypedDict): TLSMaterial: dict[str, list[str]] @type_check_only @@ -27,14 +29,17 @@ class _MetaMetaData(TypedDict, total=False): class _Metadata(TypedDict): Name: str Metadata: _MetaMetaData - Endpoints: Mapping[str, _Endpoint] + Endpoints: dict[str, _Endpoint] + +@type_check_only +class _Context(_Metadata, _TLSMaterial, _Storage): ... class Context: name: str context_type: str | None orchestrator: str | None endpoints: dict[str, _Endpoint] - tls_cfg: dict[str, Any] + tls_cfg: dict[str, _TLSConfig] meta_path: str tls_path: str def __init__( @@ -42,23 +47,23 @@ class Context: name: str, orchestrator: str | None = None, host: str | None = None, - endpoints: Mapping[str, _Endpoint] | None = None, + endpoints: dict[str, _Endpoint] | None = None, tls: bool = False, ) -> None: ... def set_endpoint( self, name: str = "docker", host: str | None = None, - tls_cfg: Mapping[str, Any] | None = None, + tls_cfg: _TLSConfig | None = None, skip_tls_verify: bool = False, def_namespace: str | None = None, ) -> None: ... - def inspect(self) -> Mapping[str, Any]: ... + def inspect(self) -> _Context: ... @classmethod def load_context(cls, name: str) -> Context | None: ... def save(self) -> None: ... def remove(self) -> None: ... - def __call__(self) -> Mapping[str, Any]: ... + def __call__(self) -> _Context: ... def is_docker_host(self) -> bool: ... @property def Name(self) -> str: ... @@ -69,7 +74,7 @@ class Context: @property def Metadata(self) -> _Metadata: ... @property - def TLSConfig(self) -> Any: ... + def TLSConfig(self) -> _TLSConfig: ... @property def TLSMaterial(self) -> _TLSMaterial: ... @property