Skip to content

Commit 23cd40d

Browse files
authored
[docker] Use TypedDict and SupportsGet for kwargs_from_context (#16132)
1 parent 4f84ac1 commit 23cd40d

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

stubs/docker/docker/context/api.pyi

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
from _typeshed import Incomplete
21
from collections.abc import Mapping, Sequence
2+
from typing import TypedDict, type_check_only
33

44
from docker.context.context import Context
55
from docker.tls import TLSConfig
66

7+
@type_check_only
8+
class _ContextKwargs(TypedDict, total=False):
9+
base_url: str
10+
tls: TLSConfig
11+
712
class ContextAPI:
813
DEFAULT_CONTEXT: Context
914
@classmethod
@@ -24,8 +29,8 @@ class ContextAPI:
2429
def get_current_context(cls) -> Context: ...
2530
@classmethod
2631
def kwargs_from_context(
27-
cls, name: str | None = None, environment: Mapping[str, str | None] | None = None
28-
) -> dict[str, Incomplete]: ... # TODO: Use TypedDict, use SupportsGet
32+
cls, name: str | None = None, environment: Mapping[str, str | None] | None = None # TODO: Use SupportsGet
33+
) -> _ContextKwargs: ...
2934
@classmethod
3035
def set_current_context(cls, name: str = "default") -> None: ...
3136
@classmethod

0 commit comments

Comments
 (0)