massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3.7 / contextvars.pyi
diff --git a/.config/coc/extensions/coc-python-data/languageServer.0.5.59/Typeshed/stdlib/3.7/contextvars.pyi b/.config/coc/extensions/coc-python-data/languageServer.0.5.59/Typeshed/stdlib/3.7/contextvars.pyi
new file mode 100644 (file)
index 0000000..4a33055
--- /dev/null
@@ -0,0 +1,30 @@
+from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union\r
+\r
+_T = TypeVar('_T')\r
+\r
+class ContextVar(Generic[_T]):\r
+    def __init__(self, name: str, *, default: _T = ...) -> None: ...\r
+    @property\r
+    def name(self) -> str: ...\r
+    def get(self, default: _T = ...) -> _T: ...\r
+    def set(self, value: _T) -> Token[_T]: ...\r
+    def reset(self, token: Token[_T]) -> None: ...\r
+\r
+class Token(Generic[_T]):\r
+    @property\r
+    def var(self) -> ContextVar[_T]: ...\r
+    @property\r
+    def old_value(self) -> Any: ...  # returns either _T or MISSING, but that's hard to express\r
+    MISSING: ClassVar[object]\r
+\r
+def copy_context() -> Context: ...\r
+\r
+# It doesn't make sense to make this generic, because for most Contexts each ContextVar will have\r
+# a different value.\r
+class Context(Mapping[ContextVar[Any], Any]):\r
+    def __init__(self) -> None: ...\r
+    def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...\r
+    def copy(self) -> Context: ...\r
+    def __getitem__(self, key: ContextVar[Any]) -> Any: ...\r
+    def __iter__(self) -> Iterator[ContextVar[Any]]: ...\r
+    def __len__(self) -> int: ...\r