add typing._Final (#13015)

This is the subset of typing module internal base classes
that are stable over all supported versions of python.
This commit is contained in:
Stephen Morton
2024-11-16 07:55:38 -08:00
committed by GitHub
parent dfbbf168c9
commit 7c7629d909
3 changed files with 9 additions and 3 deletions

View File

@@ -133,6 +133,8 @@ if sys.version_info >= (3, 13):
Any = object()
class _Final: ...
def final(f: _T) -> _T: ...
@final
class TypeVar:
@@ -191,7 +193,7 @@ _promote = object()
# N.B. Keep this definition in sync with typing_extensions._SpecialForm
@final
class _SpecialForm:
class _SpecialForm(_Final):
def __getitem__(self, parameters: Any) -> object: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
@@ -973,7 +975,7 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
def __ior__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... # type: ignore[misc]
@final
class ForwardRef:
class ForwardRef(_Final):
__forward_arg__: str
__forward_code__: CodeType
__forward_evaluated__: bool