4 TYPE_CHECKING as TYPE_CHECKING,
6 AsyncContextManager as AsyncContextManager,
7 AsyncGenerator as AsyncGenerator,
8 AsyncIterable as AsyncIterable,
9 AsyncIterator as AsyncIterator,
10 Awaitable as Awaitable,
14 ContextManager as ContextManager,
15 Coroutine as Coroutine,
17 DefaultDict as DefaultDict,
34 _F = TypeVar("_F", bound=Callable[..., Any])
35 _TC = TypeVar("_TC", bound=Type[object])
38 def __getitem__(self, typeargs: Any) -> Any: ...
40 def runtime_checkable(cls: _TC) -> _TC: ...
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 = ...
50 def final(f: _F) -> _F: ...
52 Literal: _SpecialForm = ...
54 def IntVar(name: str) -> Any: ... # returns a new TypeVar
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]
61 def copy(self: _T) -> _T: ...
62 # Using NoReturn so that only calls using mypy plugin hook that specialize the signature
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: ...
73 # TypedDict is a (non-subscriptable) special form.
74 TypedDict: object = ...
76 OrderedDict = _Alias()
78 if sys.version_info >= (3, 7):
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: ...
88 Annotated: _SpecialForm = ...
89 _AnnotatedAlias: Any = ... # undocumented
92 class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
94 def __index__(self) -> int: ...
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
101 __origin__: ParamSpec
102 def __init__(self, origin: ParamSpec) -> None: ...
103 class ParamSpecKwargs:
104 __origin__: ParamSpec
105 def __init__(self, origin: ParamSpec) -> None: ...
108 __bound__: Type[Any] | None
110 __contravariant__: bool
112 self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ...
115 def args(self) -> ParamSpecArgs: ...
117 def kwargs(self) -> ParamSpecKwargs: ...
118 Concatenate: _SpecialForm = ...
119 TypeAlias: _SpecialForm = ...
120 TypeGuard: _SpecialForm = ...
123 Unpack: _SpecialForm = ...
127 def __init__(self, name: str) -> None: ...