Fully type docker/api/build (#11789)

This commit is contained in:
kasium
2024-04-23 08:34:19 +02:00
committed by GitHub
parent 7858e6058b
commit 312dfe5791

View File

@@ -1,39 +1,55 @@
from _typeshed import Incomplete
from collections.abc import Generator
from io import StringIO
from logging import Logger
from typing import IO, Any, TypedDict, type_check_only
log: Incomplete
log: Logger
@type_check_only
class _ContainerLimits(TypedDict, total=False):
memory: int
memswap: int
cpushares: int
cpusetcpus: str
@type_check_only
class _Filers(TypedDict, total=False):
dangling: bool
until: str
class BuildApiMixin:
def build(
self,
path: Incomplete | None = None,
path: str | None = None,
tag: str | None = None,
quiet: bool = False,
fileobj: Incomplete | None = None,
fileobj: StringIO | IO[bytes] | None = None,
nocache: bool = False,
rm: bool = False,
timeout: Incomplete | None = None,
timeout: int | None = None,
custom_context: bool = False,
encoding: Incomplete | None = None,
encoding: str | None = None,
pull: bool = False,
forcerm: bool = False,
dockerfile: Incomplete | None = None,
container_limits: Incomplete | None = None,
dockerfile: str | None = None,
container_limits: _ContainerLimits | None = None,
decode: bool = False,
buildargs: Incomplete | None = None,
buildargs: dict[str, Any] | None = None,
gzip: bool = False,
shmsize: Incomplete | None = None,
labels: Incomplete | None = None,
cache_from: Incomplete | None = None,
target: Incomplete | None = None,
network_mode: Incomplete | None = None,
squash: Incomplete | None = None,
extra_hosts: Incomplete | None = None,
platform: Incomplete | None = None,
isolation: Incomplete | None = None,
shmsize: int | None = None,
labels: dict[str, Any] | None = None,
# need to use list, because the type must be json serializable
cache_from: list[str] | None = None,
target: str | None = None,
network_mode: str | None = None,
squash: bool | None = None,
extra_hosts: list[str] | dict[str, str] | None = None,
platform: str | None = None,
isolation: str | None = None,
use_config_proxy: bool = True,
): ...
) -> Generator[Any, None, None]: ...
def prune_builds(
self, filters: Incomplete | None = None, keep_storage: Incomplete | None = None, all: Incomplete | None = None
): ...
self, filters: _Filers | None = None, keep_storage: int | None = None, all: bool | None = None
) -> dict[str, Any]: ...
def process_dockerfile(dockerfile, path): ...
def process_dockerfile(dockerfile: str | None, path: str) -> tuple[str | None, str | None]: ...