mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Reduce duplication of code between typing and typing_extensions (#7075)
This commit is contained in:
@@ -20,6 +20,7 @@ class TypeVar:
|
||||
|
||||
_promote = object()
|
||||
|
||||
# N.B. Keep this definition in sync with typing_extensions._SpecialForm
|
||||
class _SpecialForm(object):
|
||||
def __getitem__(self, typeargs: Any) -> object: ...
|
||||
|
||||
@@ -44,7 +45,7 @@ _F = TypeVar("_F", bound=Callable[..., Any])
|
||||
def final(f: _F) -> _F: ...
|
||||
def overload(f: _F) -> _F: ...
|
||||
|
||||
Literal: _SpecialForm = ...
|
||||
Literal: _SpecialForm
|
||||
# TypedDict is a (non-subscriptable) special form.
|
||||
TypedDict: object
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@ from typing import ( # noqa Y022
|
||||
_T = TypeVar("_T")
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
|
||||
# unfortunately we have to duplicate this class definition from typing.pyi or we break pytype
|
||||
class _SpecialForm:
|
||||
def __getitem__(self, typeargs: Any) -> Any: ...
|
||||
def __getitem__(self, typeargs: Any) -> object: ...
|
||||
|
||||
# This alias for above is kept here for backwards compatibility.
|
||||
runtime = runtime_checkable
|
||||
|
||||
Reference in New Issue
Block a user