1- from collections .abc import Mapping
2- from typing import Any , TypedDict , type_check_only
1+ from typing import TypedDict , type_check_only
2+
3+ from docker .tls import TLSConfig as _TLSConfig
34
45@type_check_only
56class _StorageData (TypedDict ):
@@ -14,9 +15,10 @@ class _Storage(TypedDict):
1415class _Endpoint (TypedDict , total = False ):
1516 Host : str
1617 SkipTLSVerify : bool
18+ DefaultNamespace : str
1719
1820@type_check_only
19- class _TLSMaterial :
21+ class _TLSMaterial ( TypedDict ) :
2022 TLSMaterial : dict [str , list [str ]]
2123
2224@type_check_only
@@ -27,38 +29,41 @@ class _MetaMetaData(TypedDict, total=False):
2729class _Metadata (TypedDict ):
2830 Name : str
2931 Metadata : _MetaMetaData
30- Endpoints : Mapping [str , _Endpoint ]
32+ Endpoints : dict [str , _Endpoint ]
33+
34+ @type_check_only
35+ class _Context (_Metadata , _TLSMaterial , _Storage ): ...
3136
3237class Context :
3338 name : str
3439 context_type : str | None
3540 orchestrator : str | None
3641 endpoints : dict [str , _Endpoint ]
37- tls_cfg : dict [str , Any ]
42+ tls_cfg : dict [str , _TLSConfig ]
3843 meta_path : str
3944 tls_path : str
4045 def __init__ (
4146 self ,
4247 name : str ,
4348 orchestrator : str | None = None ,
4449 host : str | None = None ,
45- endpoints : Mapping [str , _Endpoint ] | None = None ,
50+ endpoints : dict [str , _Endpoint ] | None = None ,
4651 tls : bool = False ,
4752 ) -> None : ...
4853 def set_endpoint (
4954 self ,
5055 name : str = "docker" ,
5156 host : str | None = None ,
52- tls_cfg : Mapping [ str , Any ] | None = None ,
57+ tls_cfg : _TLSConfig | None = None ,
5358 skip_tls_verify : bool = False ,
5459 def_namespace : str | None = None ,
5560 ) -> None : ...
56- def inspect (self ) -> Mapping [ str , Any ] : ...
61+ def inspect (self ) -> _Context : ...
5762 @classmethod
5863 def load_context (cls , name : str ) -> Context | None : ...
5964 def save (self ) -> None : ...
6065 def remove (self ) -> None : ...
61- def __call__ (self ) -> Mapping [ str , Any ] : ...
66+ def __call__ (self ) -> _Context : ...
6267 def is_docker_host (self ) -> bool : ...
6368 @property
6469 def Name (self ) -> str : ...
@@ -69,7 +74,7 @@ class Context:
6974 @property
7075 def Metadata (self ) -> _Metadata : ...
7176 @property
72- def TLSConfig (self ) -> Any : ...
77+ def TLSConfig (self ) -> _TLSConfig : ...
7378 @property
7479 def TLSMaterial (self ) -> _TLSMaterial : ...
7580 @property
0 commit comments