massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / typing_extensions.pyi
1 import abc
2 import sys
3 from typing import (
4     TYPE_CHECKING as TYPE_CHECKING,
5     Any,
6     AsyncContextManager as AsyncContextManager,
7     AsyncGenerator as AsyncGenerator,
8     AsyncIterable as AsyncIterable,
9     AsyncIterator as AsyncIterator,
10     Awaitable as Awaitable,
11     Callable,
12     ChainMap as ChainMap,
13     ClassVar as ClassVar,
14     ContextManager as ContextManager,
15     Coroutine as Coroutine,
16     Counter as Counter,
17     DefaultDict as DefaultDict,
18     Deque as Deque,
19     ItemsView,
20     KeysView,
21     Mapping,
22     NewType as NewType,
23     NoReturn as NoReturn,
24     Text as Text,
25     Tuple,
26     Type as Type,
27     TypeVar,
28     ValuesView,
29     _Alias,
30     overload as overload,
31 )
32
33 _T = TypeVar("_T")
34 _F = TypeVar("_F", bound=Callable[..., Any])
35 _TC = TypeVar("_TC", bound=Type[object])
36
37 class _SpecialForm:
38     def __getitem__(self, typeargs: Any) -> Any: ...
39
40 def runtime_checkable(cls: _TC) -> _TC: ...
41
42 # This alias for above is kept here for backwards compatibility.
43 runtime = runtime_checkable
44 Protocol: _SpecialForm = ...
45 Final: _SpecialForm = ...
46 Self: _SpecialForm = ...
47 Required: _SpecialForm = ...
48 NotRequired: _SpecialForm = ...
49
50 def final(f: _F) -> _F: ...
51
52 Literal: _SpecialForm = ...
53
54 def IntVar(name: str) -> Any: ...  # returns a new TypeVar
55
56 # Internal mypy fallback type for all typed dicts (does not exist at runtime)
57 class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
58     __required_keys__: frozenset[str]
59     __optional_keys__: frozenset[str]
60     __total__: bool
61     def copy(self: _T) -> _T: ...
62     # Using NoReturn so that only calls using mypy plugin hook that specialize the signature
63     # can go through.
64     def setdefault(self, k: NoReturn, default: object) -> object: ...
65     # Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
66     def pop(self, k: NoReturn, default: _T = ...) -> object: ...  # type: ignore
67     def update(self: _T, __m: _T) -> None: ...
68     def items(self) -> ItemsView[str, object]: ...
69     def keys(self) -> KeysView[str]: ...
70     def values(self) -> ValuesView[object]: ...
71     def __delitem__(self, k: NoReturn) -> None: ...
72
73 # TypedDict is a (non-subscriptable) special form.
74 TypedDict: object = ...
75
76 OrderedDict = _Alias()
77
78 if sys.version_info >= (3, 7):
79     def get_type_hints(
80         obj: Callable[..., Any],
81         globalns: dict[str, Any] | None = ...,
82         localns: dict[str, Any] | None = ...,
83         include_extras: bool = ...,
84     ) -> dict[str, Any]: ...
85     def get_args(tp: Any) -> Tuple[Any, ...]: ...
86     def get_origin(tp: Any) -> Any | None: ...
87
88 Annotated: _SpecialForm = ...
89 _AnnotatedAlias: Any = ...  # undocumented
90
91 @runtime_checkable
92 class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
93     @abc.abstractmethod
94     def __index__(self) -> int: ...
95
96 # PEP 612 support for Python < 3.9
97 if sys.version_info >= (3, 10):
98     from typing import Concatenate as Concatenate, ParamSpec as ParamSpec, TypeAlias as TypeAlias, TypeGuard as TypeGuard
99 else:
100     class ParamSpecArgs:
101         __origin__: ParamSpec
102         def __init__(self, origin: ParamSpec) -> None: ...
103     class ParamSpecKwargs:
104         __origin__: ParamSpec
105         def __init__(self, origin: ParamSpec) -> None: ...
106     class ParamSpec:
107         __name__: str
108         __bound__: Type[Any] | None
109         __covariant__: bool
110         __contravariant__: bool
111         def __init__(
112             self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ...
113         ) -> None: ...
114         @property
115         def args(self) -> ParamSpecArgs: ...
116         @property
117         def kwargs(self) -> ParamSpecKwargs: ...
118     Concatenate: _SpecialForm = ...
119     TypeAlias: _SpecialForm = ...
120     TypeGuard: _SpecialForm = ...
121
122 # PEP 646
123 Unpack: _SpecialForm = ...
124
125 class TypeVarTuple:
126     __name__: str
127     def __init__(self, name: str) -> None: ...