Skip to content

contextvars.Context doesn't inherit from Mapping #12873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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
8 changes: 6 additions & 2 deletions stdlib/contextvars.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from collections.abc import Callable, Iterator, Mapping
from collections.abc import Callable, ItemsView, Iterator, KeysView, ValuesView
from typing import Any, ClassVar, Generic, TypeVar, final, overload
from typing_extensions import ParamSpec

Expand Down Expand Up @@ -47,7 +47,7 @@ def copy_context() -> Context: ...
# It doesn't make sense to make this generic, because for most Contexts each ContextVar will have
# a different value.
@final
class Context(Mapping[ContextVar[Any], Any]):
class Context:
def __init__(self) -> None: ...
@overload
def get(self, key: ContextVar[_T], default: None = None, /) -> _T | None: ...
Expand All @@ -61,3 +61,7 @@ class Context(Mapping[ContextVar[Any], Any]):
def __iter__(self) -> Iterator[ContextVar[Any]]: ...
def __len__(self) -> int: ...
def __eq__(self, value: object, /) -> bool: ...
def items(self) -> ItemsView[ContextVar[Any], Any]: ...
def keys(self) -> KeysView[ContextVar[Any]]: ...
def values(self) -> ValuesView[Any]: ...
def __contains__(self, key: object, /) -> bool: ...
Loading