mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Add types for container and net_id parameters in docker/api/network (#12042)
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any, Literal
|
||||
from typing import Any, Literal, TypedDict, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from docker.types import IPAMConfig
|
||||
|
||||
@type_check_only
|
||||
class _HasId(TypedDict):
|
||||
Id: str
|
||||
|
||||
@type_check_only
|
||||
class _HasID(TypedDict):
|
||||
ID: str
|
||||
|
||||
_Network: TypeAlias = _HasId | _HasID | str
|
||||
_Container: TypeAlias = _HasId | _HasID | str
|
||||
|
||||
class NetworkApiMixin:
|
||||
def networks(self, names: Incomplete | None = None, ids: Incomplete | None = None, filters: Incomplete | None = None): ...
|
||||
def create_network(
|
||||
@@ -20,12 +32,12 @@ class NetworkApiMixin:
|
||||
ingress: bool | None = None,
|
||||
) -> dict[str, str]: ...
|
||||
def prune_networks(self, filters: Incomplete | None = None): ...
|
||||
def remove_network(self, net_id) -> None: ...
|
||||
def inspect_network(self, net_id, verbose: Incomplete | None = None, scope: Incomplete | None = None): ...
|
||||
def remove_network(self, net_id: _Network) -> None: ...
|
||||
def inspect_network(self, net_id: _Network, verbose: Incomplete | None = None, scope: Incomplete | None = None): ...
|
||||
def connect_container_to_network(
|
||||
self,
|
||||
container,
|
||||
net_id,
|
||||
container: _Container,
|
||||
net_id: str,
|
||||
ipv4_address: Incomplete | None = None,
|
||||
ipv6_address: Incomplete | None = None,
|
||||
aliases: Incomplete | None = None,
|
||||
@@ -34,4 +46,4 @@ class NetworkApiMixin:
|
||||
driver_opt: Incomplete | None = None,
|
||||
mac_address: Incomplete | None = None,
|
||||
) -> None: ...
|
||||
def disconnect_container_from_network(self, container, net_id, force: bool = False) -> None: ...
|
||||
def disconnect_container_from_network(self, container: _Container, net_id: str, force: bool = False) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user