make contextvars.Context instantiable (#2119)

Part of #1476.
This commit is contained in:
Jelle Zijlstra
2018-06-11 14:03:02 -07:00
committed by Guido van Rossum
parent f789ee25ad
commit c5bc3bd7fa

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, ClassVar, Generic, Mapping, TypeVar, Union
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union
_T = TypeVar('_T')
@@ -25,3 +25,6 @@ class Context(Mapping[ContextVar[Any], Any]):
def __init__(self) -> None: ...
def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
def copy(self) -> Context: ...
def __getitem__(self, key: ContextVar[Any]) -> Any: ...
def __iter__(self) -> Iterator[ContextVar[Any]]: ...
def __len___(self) -> int: ...