Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stubs/docker/docker/errors.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from collections.abc import Iterator, Mapping
from typing import NoReturn

from docker.models.containers import Container
Expand Down Expand Up @@ -47,8 +47,8 @@ class StreamParseError(RuntimeError):

class BuildError(DockerException):
msg: str
build_log: str
def __init__(self, reason: str, build_log: str) -> None: ...
build_log: Iterator[dict[str, str]]
def __init__(self, reason: str, build_log: Iterator[dict[str, str]]) -> None: ...

class ImageLoadError(DockerException): ...

Expand Down
24 changes: 16 additions & 8 deletions stubs/docker/docker/utils/json_stream.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
from _typeshed import Incomplete
from collections.abc import Generator
import json
from collections.abc import Callable, Generator, Iterator
from typing import Any
from typing_extensions import TypeAlias

json_decoder: Incomplete
json_decoder: json.JSONDecoder

def stream_as_text(stream) -> Generator[Incomplete, None, None]: ...
def json_splitter(buffer): ...
def json_stream(stream): ...
def line_splitter(buffer, separator: str = "\n"): ...
def split_buffer(stream, splitter: Incomplete | None = None, decoder=...) -> Generator[Incomplete, None, Incomplete]: ...
# Type alias for JSON, explained at:
# https://github.com/python/typing/issues/182#issuecomment-1320974824.
_JSON: TypeAlias = dict[str, _JSON] | list[_JSON] | str | int | float | bool | None

def stream_as_text(stream: Iterator[str | bytes]) -> Generator[str, None, None]: ...
def json_splitter(buffer: str) -> tuple[_JSON, str] | None: ...
def json_stream(stream: Iterator[str]) -> Generator[_JSON, None, None]: ...
def line_splitter(buffer: str, separator: str = "\n") -> tuple[str, str] | None: ...
def split_buffer(
stream: Iterator[str | bytes], splitter: Callable[[str], tuple[str, str]] | None = None, decoder: Callable[[str], Any] = ...
) -> Generator[Any, None, None]: ...