Specify stream type of Docker logs (#12214)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Adam Dangoor
2024-07-02 18:47:47 +01:00
committed by GitHub
parent d498fe148e
commit 02d2f5f09e
4 changed files with 15 additions and 8 deletions

View File

@@ -105,7 +105,7 @@ class ContainerApiMixin:
since: datetime.datetime | float | None = None,
follow: bool | None = None,
until: datetime.datetime | float | None = None,
) -> CancellableStream: ...
) -> CancellableStream[bytes]: ...
@overload
def logs(
self,
@@ -118,7 +118,7 @@ class ContainerApiMixin:
since: datetime.datetime | float | None = None,
follow: bool | None = None,
until: datetime.datetime | float | None = None,
) -> CancellableStream: ...
) -> CancellableStream[bytes]: ...
@overload
def logs(
self,

View File

@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from datetime import datetime
from typing import Any
@@ -11,7 +12,7 @@ class DaemonApiMixin:
until: datetime | int | None = None,
filters: dict[str, Any] | None = None,
decode: bool | None = None,
) -> CancellableStream: ...
) -> CancellableStream[Incomplete]: ...
def info(self) -> dict[str, Any]: ...
def login(
self,

View File

@@ -61,7 +61,7 @@ class Container(Model):
since: datetime.datetime | float | None = None,
follow: bool | None = None,
until: datetime.datetime | float | None = None,
) -> CancellableStream: ...
) -> CancellableStream[bytes]: ...
@overload
def logs(
self,

View File

@@ -1,6 +1,12 @@
class CancellableStream:
def __init__(self, stream, response) -> None: ...
def __iter__(self): ...
def __next__(self): ...
from collections.abc import Iterator
from typing import Generic, TypeVar
from typing_extensions import Self
_T_co = TypeVar("_T_co", covariant=True)
class CancellableStream(Generic[_T_co]):
def __init__(self, stream: Iterator[_T_co], response) -> None: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T_co: ...
next = __next__
def close(self) -> None: ...