-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
Copy pathtyping_extensions.pyi
99 lines (77 loc) · 2.85 KB
/
typing_extensions.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import typing
from typing import Any, Callable, Mapping, Iterable, Iterator, NoReturn as NoReturn, Dict, Tuple, Type, Union
from typing import TYPE_CHECKING as TYPE_CHECKING
from typing import NewType as NewType, overload as overload
import sys
_T = typing.TypeVar('_T')
class _SpecialForm:
def __getitem__(self, typeargs: Any) -> Any:
pass
def __call__(self, arg: Any) -> Any:
pass
NamedTuple = 0
Protocol: _SpecialForm = ...
def runtime_checkable(x: _T) -> _T: pass
runtime = runtime_checkable
Final: _SpecialForm = ...
def final(x: _T) -> _T: pass
Literal: _SpecialForm = ...
Annotated: _SpecialForm = ...
TypeVar: _SpecialForm
ParamSpec: _SpecialForm
Concatenate: _SpecialForm
TypeAlias: _SpecialForm
TypeGuard: _SpecialForm
TypeIs: _SpecialForm
Never: _SpecialForm
TypeVarTuple: _SpecialForm
Unpack: _SpecialForm
Required: _SpecialForm
NotRequired: _SpecialForm
ReadOnly: _SpecialForm
Self: _SpecialForm
NoMatch: _SpecialForm
@final
class TypeAliasType:
def __init__(
self, name: str, value: Any, *, type_params: Tuple[Union[TypeVar, ParamSpec, TypeVarTuple], ...] = ()
) -> None: ...
# Fallback type for all typed dicts (does not exist at runtime).
class _TypedDict(Mapping[str, object]):
# Needed to make this class non-abstract. It is explicitly declared abstract in
# typeshed, but we don't want to import abc here, as it would slow down the tests.
def __iter__(self) -> Iterator[str]: ...
def copy(self: _T) -> _T: ...
# Using NoReturn so that only calls using the plugin hook can go through.
def setdefault(self, k: NoReturn, default: object) -> object: ...
# Mypy expects that 'default' has a type variable type.
def pop(self, k: NoReturn, default: _T = ...) -> object: ...
def update(self: _T, __m: _T) -> None: ...
def items(self) -> Iterable[Tuple[str, object]]: ...
def keys(self) -> Iterable[str]: ...
def values(self) -> Iterable[object]: ...
if sys.version_info < (3, 0):
def has_key(self, k: str) -> bool: ...
def __delitem__(self, k: NoReturn) -> None: ...
# Stubtest's tests need the following items:
__required_keys__: frozenset[str]
__optional_keys__: frozenset[str]
__readonly_keys__: frozenset[str]
__mutable_keys__: frozenset[str]
__closed__: bool
__extra_items__: Any
__total__: bool
def TypedDict(typename: str, fields: Dict[str, Type[_T]], *, total: Any = ...) -> Type[dict]: ...
def reveal_type(__obj: _T) -> _T: pass
def assert_type(__val: _T, __typ: Any) -> _T: pass
def dataclass_transform(
*,
eq_default: bool = ...,
order_default: bool = ...,
kw_only_default: bool = ...,
field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ...,
**kwargs: Any,
) -> Callable[[_T], _T]: ...
def override(__arg: _T) -> _T: ...
def deprecated(__msg: str) -> Callable[[_T], _T]: ...
_FutureFeatureFixture = 0