massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / mypy-extensions / mypy_extensions.pyi
1 import abc
2 import sys
3 from typing import Any, Callable, Generic, ItemsView, KeysView, Mapping, Type, TypeVar, Union, ValuesView
4
5 _T = TypeVar("_T")
6 _U = TypeVar("_U")
7
8 # Internal mypy fallback type for all typed dicts (does not exist at runtime)
9 class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
10     def copy(self: _T) -> _T: ...
11     # Using NoReturn so that only calls using mypy plugin hook that specialize the signature
12     # can go through.
13     def setdefault(self, k: NoReturn, default: object) -> object: ...
14     # Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
15     def pop(self, k: NoReturn, default: _T = ...) -> object: ...  # type: ignore
16     def update(self: _T, __m: _T) -> None: ...
17     if sys.version_info >= (3, 0):
18         def items(self) -> ItemsView[str, object]: ...
19         def keys(self) -> KeysView[str]: ...
20         def values(self) -> ValuesView[object]: ...
21     else:
22         def has_key(self, k: str) -> bool: ...
23         def viewitems(self) -> ItemsView[str, object]: ...
24         def viewkeys(self) -> KeysView[str]: ...
25         def viewvalues(self) -> ValuesView[object]: ...
26     def __delitem__(self, k: NoReturn) -> None: ...
27
28 def TypedDict(typename: str, fields: dict[str, Type[Any]], total: bool = ...) -> Type[dict[str, Any]]: ...
29 def Arg(type: _T = ..., name: str | None = ...) -> _T: ...
30 def DefaultArg(type: _T = ..., name: str | None = ...) -> _T: ...
31 def NamedArg(type: _T = ..., name: str | None = ...) -> _T: ...
32 def DefaultNamedArg(type: _T = ..., name: str | None = ...) -> _T: ...
33 def VarArg(type: _T = ...) -> _T: ...
34 def KwArg(type: _T = ...) -> _T: ...
35
36 # Return type that indicates a function does not return.
37 # This type is equivalent to the None type, but the no-op Union is necessary to
38 # distinguish the None type from the None value.
39 NoReturn = Union[None]  # Deprecated: Use typing.NoReturn instead.
40
41 # This is intended as a class decorator, but mypy rejects abstract classes
42 # when a Type[_T] is expected, so we can't give it the type we want
43 def trait(cls: Any) -> Any: ...
44 def mypyc_attr(*attrs: str, **kwattrs: object) -> Callable[[_T], _T]: ...
45
46 class FlexibleAlias(Generic[_T, _U]): ...