Debian Codegraph @

test-data/unit/lib-stub/typing_extensions.pyi

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