@@ -42,6 +42,7 @@ from typing import ( # noqa: Y022,UP035
4242 Any ,
4343 BinaryIO ,
4444 ClassVar ,
45+ Final ,
4546 Generic ,
4647 Mapping ,
4748 MutableMapping ,
@@ -188,8 +189,9 @@ class type:
188189 __bases__ : tuple [type , ...]
189190 @property
190191 def __basicsize__ (self ) -> int : ...
191- @property
192- def __dict__ (self ) -> types .MappingProxyType [str , Any ]: ... # type: ignore[override]
192+ # type.__dict__ is read-only at runtime, but that can't be expressed currently.
193+ # See https://github.com/python/typeshed/issues/11033 for a discussion.
194+ __dict__ : Final [types .MappingProxyType [str , Any ]] # type: ignore[assignment]
193195 @property
194196 def __dictoffset__ (self ) -> int : ...
195197 @property
@@ -1267,13 +1269,6 @@ class property:
12671269 def __set__ (self , instance : Any , value : Any , / ) -> None : ...
12681270 def __delete__ (self , instance : Any , / ) -> None : ...
12691271
1270- @final
1271- @type_check_only
1272- class _NotImplementedType (Any ):
1273- __call__ : None
1274-
1275- NotImplemented : _NotImplementedType
1276-
12771272def abs (x : SupportsAbs [_T ], / ) -> _T : ...
12781273def all (iterable : Iterable [object ], / ) -> bool : ...
12791274def any (iterable : Iterable [object ], / ) -> bool : ...
@@ -1932,14 +1927,14 @@ def __import__(
19321927def __build_class__ (func : Callable [[], CellType | Any ], name : str , / , * bases : Any , metaclass : Any = ..., ** kwds : Any ) -> Any : ...
19331928
19341929if sys .version_info >= (3 , 10 ):
1935- from types import EllipsisType
1930+ from types import EllipsisType , NotImplementedType
19361931
19371932 # Backwards compatibility hack for folks who relied on the ellipsis type
19381933 # existing in typeshed in Python 3.9 and earlier.
19391934 ellipsis = EllipsisType
19401935
19411936 Ellipsis : EllipsisType
1942-
1937+ NotImplemented : NotImplementedType
19431938else :
19441939 # Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
19451940 # not exposed anywhere under that name, we make it private here.
@@ -1949,6 +1944,12 @@ else:
19491944
19501945 Ellipsis : ellipsis
19511946
1947+ @final
1948+ @type_check_only
1949+ class _NotImplementedType (Any ): ...
1950+
1951+ NotImplemented : _NotImplementedType
1952+
19521953@disjoint_base
19531954class BaseException :
19541955 args : tuple [Any , ...]
0 commit comments