mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-30 08:04:24 +08:00
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:
@@ -462,6 +462,8 @@ typing_extensions\.ParamSpec.*
|
||||
typing(_extensions)?\.Generic
|
||||
typing\.Protocol
|
||||
typing(_extensions)?\._TypedDict
|
||||
typing._Final
|
||||
typing._Final.__init_subclass__
|
||||
|
||||
# Special primitives
|
||||
typing_extensions\.Final
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user