Skip to content
Closed
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
17 changes: 13 additions & 4 deletions stubs/docker/docker/context/api.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
from _typeshed import Incomplete
from collections.abc import Mapping, Sequence
from collections.abc import Sequence
from typing import Any, Protocol, TypedDict, type_check_only

from docker.context.context import Context
from docker.tls import TLSConfig

@type_check_only
class _SupportsGet(Protocol):
def get(self, key: str, default: Any = ...) -> Any: ...

Comment thread
Ashid332 marked this conversation as resolved.
@type_check_only
class _ContextKwargs(TypedDict, total=False):
base_url: str
tls: TLSConfig

class ContextAPI:
DEFAULT_CONTEXT: Context
@classmethod
Expand All @@ -24,8 +33,8 @@
def get_current_context(cls) -> Context: ...
@classmethod
def kwargs_from_context(
cls, name: str | None = None, environment: Mapping[str, str | None] | None = None
) -> dict[str, Incomplete]: ... # TODO: Use TypedDict, use SupportsGet
cls, name: str | None = None, environment: Mapping[str, str | None] | None = None # TODO: Use SupportsGet

Check failure on line 36 in stubs/docker/docker/context/api.pyi

View workflow job for this annotation

GitHub Actions / pyright: Run test cases (Linux, 3.13)

"Mapping" is not defined (reportUndefinedVariable)
) -> _ContextKwargs: ...
@classmethod
def set_current_context(cls, name: str = "default") -> None: ...
@classmethod
Expand Down
Loading