11from collections .abc import Iterable
2- from typing import NoReturn , Protocol , type_check_only
2+ from typing import Any , Literal , NoReturn , Protocol , overload , type_check_only
33
44from docker import APIClient
55from docker .models .configs import ConfigCollection
@@ -12,6 +12,7 @@ from docker.models.secrets import SecretCollection
1212from docker .models .services import ServiceCollection
1313from docker .models .swarm import Swarm
1414from docker .models .volumes import VolumeCollection
15+ from docker .types import CancellableStream
1516
1617@type_check_only
1718class _Environ (Protocol ):
@@ -51,13 +52,16 @@ class DockerClient:
5152 def swarm (self ) -> Swarm : ...
5253 @property
5354 def volumes (self ) -> VolumeCollection : ...
54- def events (self , * args , ** kwargs ): ...
55- def df (self ): ...
56- def info (self , * args , ** kwargs ): ...
57- def login (self , * args , ** kwargs ): ...
58- def ping (self , * args , ** kwargs ): ...
59- def version (self , * args , ** kwargs ): ...
60- def close (self ): ...
55+ @overload
56+ def events (self , * args , decode : Literal [False ] | None = None , ** kwargs ) -> CancellableStream [str ]: ...
57+ @overload
58+ def events (self , * args , decode : Literal [True ] = ..., ** kwargs ) -> CancellableStream [dict [str , Any ]]: ...
59+ def df (self ) -> dict [str , Any ]: ...
60+ def info (self , * args , ** kwargs ) -> dict [str , Any ]: ...
61+ def login (self , * args , ** kwargs ) -> dict [str , Any ]: ...
62+ def ping (self , * args , ** kwargs ) -> bool : ...
63+ def version (self , * args , ** kwargs ) -> dict [str , Any ]: ...
64+ def close (self ) -> None : ...
6165 def __getattr__ (self , name : str ) -> NoReturn : ...
6266
6367from_env = DockerClient .from_env
0 commit comments