11from _typeshed import Incomplete
2- from typing import Literal
2+ from collections .abc import Iterable , Mapping
3+ from typing import Any , Final , Literal
34
45from docker ._types import ContainerWeightDevice
56
7+ from .. import errors
68from .base import DictType
9+ from .healthcheck import Healthcheck
10+ from .networks import NetworkingConfig
711from .services import Mount
812
913class LogConfigTypesEnum :
10- JSON : Incomplete
11- SYSLOG : Incomplete
12- JOURNALD : Incomplete
13- GELF : Incomplete
14- FLUENTD : Incomplete
15- NONE : Incomplete
14+ JSON : Final = "json-file"
15+ SYSLOG : Final = "syslog"
16+ JOURNALD : Final = "journald"
17+ GELF : Final = "gelf"
18+ FLUENTD : Final = "fluentd"
19+ NONE : Final = "none"
1620
1721class LogConfig (DictType ):
1822 types : type [LogConfigTypesEnum ]
@@ -68,21 +72,21 @@ class HostConfig(dict[str, Incomplete]):
6872 def __init__ (
6973 self ,
7074 version : str ,
71- binds : Incomplete | None = None ,
72- port_bindings : Incomplete | None = None ,
73- lxc_conf : dict [Incomplete , Incomplete ] | None = None ,
75+ binds : dict [ str , Mapping [ str , str ]] | list [ str ] | None = None ,
76+ port_bindings : Mapping [ int | str , Incomplete ] | None = None ,
77+ lxc_conf : dict [str , Incomplete ] | list [ dict [ str , Incomplete ] ] | None = None ,
7478 publish_all_ports : bool = False ,
75- links : dict [str , str | None ] | None = None ,
79+ links : dict [str , str ] | dict [ str , None ] | dict [ str , str | None ] | Iterable [ tuple [ str , str | None ] ] | None = None ,
7680 privileged : bool = False ,
77- dns : list [Incomplete ] | None = None ,
78- dns_search : list [Incomplete ] | None = None ,
81+ dns : list [str ] | None = None ,
82+ dns_search : list [str ] | None = None ,
7983 volumes_from : list [str ] | None = None ,
8084 network_mode : str | None = None ,
81- restart_policy : dict [ Incomplete , Incomplete ] | None = None ,
85+ restart_policy : Mapping [ str , str | int ] | None = None ,
8286 cap_add : list [str ] | None = None ,
8387 cap_drop : list [str ] | None = None ,
8488 devices : list [str ] | None = None ,
85- extra_hosts : dict [Incomplete , Incomplete ] | None = None ,
89+ extra_hosts : dict [str , Incomplete ] | list [ Incomplete ] | None = None ,
8690 read_only : bool | None = None ,
8791 pid_mode : str | None = None ,
8892 ipc_mode : str | None = None ,
@@ -95,18 +99,18 @@ class HostConfig(dict[str, Incomplete]):
9599 kernel_memory : str | int | None = None ,
96100 mem_swappiness : int | None = None ,
97101 cgroup_parent : str | None = None ,
98- group_add : list [str | int ] | None = None ,
102+ group_add : Iterable [str | int ] | None = None ,
99103 cpu_quota : int | None = None ,
100104 cpu_period : int | None = None ,
101105 blkio_weight : int | None = None ,
102106 blkio_weight_device : list [ContainerWeightDevice ] | None = None ,
103- device_read_bps : Incomplete | None = None ,
104- device_write_bps : Incomplete | None = None ,
105- device_read_iops : Incomplete | None = None ,
106- device_write_iops : Incomplete | None = None ,
107+ device_read_bps : list [ Mapping [ str , str | int ]] | None = None ,
108+ device_write_bps : list [ Mapping [ str , str | int ]] | None = None ,
109+ device_read_iops : list [ Mapping [ str , str | int ]] | None = None ,
110+ device_write_iops : list [ Mapping [ str , str | int ]] | None = None ,
107111 oom_kill_disable : bool = False ,
108112 shm_size : str | int | None = None ,
109- sysctls : dict [Incomplete , Incomplete ] | None = None ,
113+ sysctls : dict [str , str ] | None = None ,
110114 tmpfs : dict [str , str ] | None = None ,
111115 oom_score_adj : int | None = None ,
112116 dns_opt : list [Incomplete ] | None = None ,
@@ -134,35 +138,37 @@ class HostConfig(dict[str, Incomplete]):
134138 cgroupns : Literal ["private" , "host" ] | None = None ,
135139 ) -> None : ...
136140
137- def host_config_type_error (param , param_value , expected ) : ...
138- def host_config_version_error (param , version , less_than : bool = True ): ...
139- def host_config_value_error (param , param_value ) : ...
140- def host_config_incompatible_error (param , param_value , incompatible_param ) : ...
141+ def host_config_type_error (param : str , param_value : object , expected : str ) -> TypeError : ...
142+ def host_config_version_error (param : str , version : str , less_than : bool = True ) -> errors . InvalidVersion : ...
143+ def host_config_value_error (param : str , param_value : object ) -> ValueError : ...
144+ def host_config_incompatible_error (param : str , param_value : str , incompatible_param : str ) -> errors . InvalidArgument : ...
141145
142146class ContainerConfig (dict [str , Incomplete ]):
143147 def __init__ (
144148 self ,
145149 version : str ,
146- image ,
150+ image : str ,
147151 command : str | list [str ],
148152 hostname : str | None = None ,
149153 user : str | int | None = None ,
150154 detach : bool = False ,
151155 stdin_open : bool = False ,
152156 tty : bool = False ,
153- ports : dict [str , int | list [int ] | tuple [str , int ] | None ] | None = None ,
157+ # list is invariant, enumerating all possible union combination would be too complex for:
158+ # list[str | int | tuple[int | str, str] | tuple[int | str, ...]]
159+ ports : dict [str , dict [Incomplete , Incomplete ]] | list [Any ] | None = None ,
154160 environment : dict [str , str ] | list [str ] | None = None ,
155161 volumes : str | list [str ] | None = None ,
156162 network_disabled : bool = False ,
157163 entrypoint : str | list [str ] | None = None ,
158164 working_dir : str | None = None ,
159165 domainname : str | None = None ,
160- host_config : Incomplete | None = None ,
166+ host_config : HostConfig | None = None ,
161167 mac_address : str | None = None ,
162168 labels : dict [str , str ] | list [str ] | None = None ,
163169 stop_signal : str | None = None ,
164- networking_config : Incomplete | None = None ,
165- healthcheck : Incomplete | None = None ,
170+ networking_config : NetworkingConfig | None = None ,
171+ healthcheck : Healthcheck | None = None ,
166172 stop_timeout : int | None = None ,
167173 runtime : str | None = None ,
168174 ) -> None : ...
0 commit comments