1
1
from _typeshed import Incomplete
2
- from typing import Literal
2
+ from collections .abc import Iterable , Mapping
3
+ from typing import Any , Final , Literal
3
4
4
5
from docker ._types import ContainerWeightDevice
5
6
7
+ from .. import errors
6
8
from .base import DictType
9
+ from .healthcheck import Healthcheck
10
+ from .networks import NetworkingConfig
7
11
from .services import Mount
8
12
9
13
class 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"
16
20
17
21
class LogConfig (DictType ):
18
22
types : type [LogConfigTypesEnum ]
@@ -68,21 +72,21 @@ class HostConfig(dict[str, Incomplete]):
68
72
def __init__ (
69
73
self ,
70
74
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 ,
74
78
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 ,
76
80
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 ,
79
83
volumes_from : list [str ] | None = None ,
80
84
network_mode : str | None = None ,
81
- restart_policy : dict [ Incomplete , Incomplete ] | None = None ,
85
+ restart_policy : Mapping [ str , str | int ] | None = None ,
82
86
cap_add : list [str ] | None = None ,
83
87
cap_drop : list [str ] | None = None ,
84
88
devices : list [str ] | None = None ,
85
- extra_hosts : dict [Incomplete , Incomplete ] | None = None ,
89
+ extra_hosts : dict [str , Incomplete ] | list [ Incomplete ] | None = None ,
86
90
read_only : bool | None = None ,
87
91
pid_mode : str | None = None ,
88
92
ipc_mode : str | None = None ,
@@ -95,18 +99,18 @@ class HostConfig(dict[str, Incomplete]):
95
99
kernel_memory : str | int | None = None ,
96
100
mem_swappiness : int | None = None ,
97
101
cgroup_parent : str | None = None ,
98
- group_add : list [str | int ] | None = None ,
102
+ group_add : Iterable [str | int ] | None = None ,
99
103
cpu_quota : int | None = None ,
100
104
cpu_period : int | None = None ,
101
105
blkio_weight : int | None = None ,
102
106
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 ,
107
111
oom_kill_disable : bool = False ,
108
112
shm_size : str | int | None = None ,
109
- sysctls : dict [Incomplete , Incomplete ] | None = None ,
113
+ sysctls : dict [str , str ] | None = None ,
110
114
tmpfs : dict [str , str ] | None = None ,
111
115
oom_score_adj : int | None = None ,
112
116
dns_opt : list [Incomplete ] | None = None ,
@@ -134,35 +138,37 @@ class HostConfig(dict[str, Incomplete]):
134
138
cgroupns : Literal ["private" , "host" ] | None = None ,
135
139
) -> None : ...
136
140
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 : ...
141
145
142
146
class ContainerConfig (dict [str , Incomplete ]):
143
147
def __init__ (
144
148
self ,
145
149
version : str ,
146
- image ,
150
+ image : str ,
147
151
command : str | list [str ],
148
152
hostname : str | None = None ,
149
153
user : str | int | None = None ,
150
154
detach : bool = False ,
151
155
stdin_open : bool = False ,
152
156
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 ,
154
160
environment : dict [str , str ] | list [str ] | None = None ,
155
161
volumes : str | list [str ] | None = None ,
156
162
network_disabled : bool = False ,
157
163
entrypoint : str | list [str ] | None = None ,
158
164
working_dir : str | None = None ,
159
165
domainname : str | None = None ,
160
- host_config : Incomplete | None = None ,
166
+ host_config : HostConfig | None = None ,
161
167
mac_address : str | None = None ,
162
168
labels : dict [str , str ] | list [str ] | None = None ,
163
169
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 ,
166
172
stop_timeout : int | None = None ,
167
173
runtime : str | None = None ,
168
174
) -> None : ...
0 commit comments