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

@@ -190,8 +190,10 @@ _T = typing.TypeVar("_T")
_F = typing.TypeVar("_F", bound=Callable[..., Any])
_TC = typing.TypeVar("_TC", bound=type[object])
class _Final: ... # This should be imported from typing but that breaks pytype
# unfortunately we have to duplicate this class definition from typing.pyi or we break pytype
class _SpecialForm:
class _SpecialForm(_Final):
def __getitem__(self, parameters: Any) -> object: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...