1- from collections .abc import Iterable
1+ from _typeshed import Incomplete
2+ from collections .abc import Iterable , Mapping
23from typing import Any , Literal , NoReturn , Protocol , overload , type_check_only
34
45from docker import APIClient
@@ -12,6 +13,7 @@ from docker.models.secrets import SecretCollection
1213from docker .models .services import ServiceCollection
1314from docker .models .swarm import Swarm
1415from docker .models .volumes import VolumeCollection
16+ from docker .tls import TLSConfig
1517from docker .types import CancellableStream
1618
1719@type_check_only
@@ -21,17 +23,45 @@ class _Environ(Protocol):
2123
2224class DockerClient :
2325 api : APIClient
24- def __init__ (self , * args , ** kwargs ) -> None : ...
26+ # Please keep in sync with docker.APIClient
27+ def __init__ (
28+ self ,
29+ base_url : str | None = None ,
30+ version : str | None = None ,
31+ timeout : int = 60 ,
32+ tls : bool | TLSConfig = False ,
33+ user_agent : str = ...,
34+ num_pools : int | None = None ,
35+ credstore_env : Mapping [Incomplete , Incomplete ] | None = None ,
36+ use_ssh_client : bool = False ,
37+ max_pool_size : int = 10 ,
38+ ) -> None : ...
2539 @classmethod
2640 def from_env (
2741 cls ,
2842 * ,
2943 version : str | None = None ,
30- timeout : int = ... ,
31- max_pool_size : int = ... ,
44+ timeout : int = 60 ,
45+ max_pool_size : int = 10 ,
3246 environment : _Environ | None = None ,
3347 use_ssh_client : bool = False ,
48+ use_context : bool = True ,
3449 ) -> DockerClient : ...
50+ @classmethod
51+ def from_context (
52+ cls ,
53+ name = None ,
54+ * ,
55+ version : str | None = None ,
56+ timeout : int = 60 ,
57+ max_pool_size : int = 10 ,
58+ use_ssh_client : bool = False ,
59+ base_url : str | None = None ,
60+ tls : bool | TLSConfig = False ,
61+ user_agent : str = ...,
62+ num_pools : int | None = None ,
63+ credstore_env : Mapping [Incomplete , Incomplete ] | None = None ,
64+ ): ...
3565 @property
3666 def configs (self ) -> ConfigCollection : ...
3767 @property
@@ -59,11 +89,20 @@ class DockerClient:
5989 def events (self , * args , decode : Literal [True ] = ..., ** kwargs ) -> CancellableStream [dict [str , Any ]]: ...
6090
6191 def df (self ) -> dict [str , Any ]: ...
62- def info (self , * args , ** kwargs ) -> dict [str , Any ]: ...
63- def login (self , * args , ** kwargs ) -> dict [str , Any ]: ...
64- def ping (self , * args , ** kwargs ) -> bool : ...
65- def version (self , * args , ** kwargs ) -> dict [str , Any ]: ...
92+ def info (self ) -> dict [str , Any ]: ...
93+ def login (
94+ self ,
95+ username : str ,
96+ password : str | None = None ,
97+ email : str | None = None ,
98+ registry : str | None = None ,
99+ reauth : bool = False ,
100+ dockercfg_path : str | None = None ,
101+ ) -> dict [str , Any ]: ...
102+ def ping (self ) -> bool : ...
103+ def version (self , api_version : bool = True ) -> dict [str , Any ]: ...
66104 def close (self ) -> None : ...
67105 def __getattr__ (self , name : str ) -> NoReturn : ...
68106
69107from_env = DockerClient .from_env
108+ from_context = DockerClient .from_context
0 commit comments