@@ -48,6 +48,11 @@ def __getitem__(self, typeargs: Any) -> object: ...
48
48
Generic: _SpecialForm = ...
49
49
Protocol: _SpecialForm = ...
50
50
Union: _SpecialForm = ...
51
+ ClassVar: _SpecialForm = ...
52
+
53
+ Final = 0
54
+ Literal = 0
55
+ TypedDict = 0
51
56
52
57
class TypeVar:
53
58
def __init__(self, name, covariant: bool = ..., contravariant: bool = ...) -> None: ...
@@ -71,6 +76,12 @@ class Match(Generic[AnyStr]): ...
71
76
class Sequence(Iterable[_T_co]): ...
72
77
class Tuple(Sequence[_T_co]): ...
73
78
class NamedTuple(tuple[Any, ...]): ...
79
+ class _TypedDict(Mapping[str, object]):
80
+ __required_keys__: ClassVar[frozenset[str]]
81
+ __optional_keys__: ClassVar[frozenset[str]]
82
+ __total__: ClassVar[bool]
83
+ __readonly_keys__: ClassVar[frozenset[str]]
84
+ __mutable_keys__: ClassVar[frozenset[str]]
74
85
def overload(func: _T) -> _T: ...
75
86
def type_check_only(func: _T) -> _T: ...
76
87
def final(func: _T) -> _T: ...
@@ -95,6 +106,8 @@ def __ge__(self, __other: tuple[T_co, ...]) -> bool: pass
95
106
96
107
class dict(Mapping[KT, VT]): ...
97
108
109
+ class frozenset(Generic[T]): ...
110
+
98
111
class function: pass
99
112
class ellipsis: pass
100
113
@@ -1373,7 +1386,7 @@ def spam(x=Flags4(0)): pass
1373
1386
)
1374
1387
yield Case (
1375
1388
stub = """
1376
- from typing_extensions import Final, Literal
1389
+ from typing import Final, Literal
1377
1390
class BytesEnum(bytes, enum.Enum):
1378
1391
a = b'foo'
1379
1392
FOO: Literal[BytesEnum.a]
@@ -1915,7 +1928,7 @@ def __init__(self, x): pass
1915
1928
def test_good_literal (self ) -> Iterator [Case ]:
1916
1929
yield Case (
1917
1930
stub = r"""
1918
- from typing_extensions import Literal
1931
+ from typing import Literal
1919
1932
1920
1933
import enum
1921
1934
class Color(enum.Enum):
@@ -1947,7 +1960,7 @@ class Color(enum.Enum):
1947
1960
1948
1961
@collect_cases
1949
1962
def test_bad_literal (self ) -> Iterator [Case ]:
1950
- yield Case ("from typing_extensions import Literal" , "" , None ) # dummy case
1963
+ yield Case ("from typing import Literal" , "" , None ) # dummy case
1951
1964
yield Case (
1952
1965
stub = "INT_FLOAT_MISMATCH: Literal[1]" ,
1953
1966
runtime = "INT_FLOAT_MISMATCH = 1.0" ,
@@ -1998,7 +2011,7 @@ def test_special_subtype(self) -> Iterator[Case]:
1998
2011
)
1999
2012
yield Case (
2000
2013
stub = """
2001
- from typing_extensions import TypedDict
2014
+ from typing import TypedDict
2002
2015
2003
2016
class _Options(TypedDict):
2004
2017
a: str
@@ -2019,8 +2032,8 @@ class _Options(TypedDict):
2019
2032
@collect_cases
2020
2033
def test_runtime_typing_objects (self ) -> Iterator [Case ]:
2021
2034
yield Case (
2022
- stub = "from typing_extensions import Protocol, TypedDict" ,
2023
- runtime = "from typing_extensions import Protocol, TypedDict" ,
2035
+ stub = "from typing import Protocol, TypedDict" ,
2036
+ runtime = "from typing import Protocol, TypedDict" ,
2024
2037
error = None ,
2025
2038
)
2026
2039
yield Case (
@@ -2385,8 +2398,8 @@ class A2: ...
2385
2398
)
2386
2399
# The same is true for NamedTuples and TypedDicts:
2387
2400
yield Case (
2388
- stub = "from typing_extensions import NamedTuple, TypedDict" ,
2389
- runtime = "from typing_extensions import NamedTuple, TypedDict" ,
2401
+ stub = "from typing import NamedTuple, TypedDict" ,
2402
+ runtime = "from typing import NamedTuple, TypedDict" ,
2390
2403
error = None ,
2391
2404
)
2392
2405
yield Case (
0 commit comments