mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-25 18:16:36 +08:00
Reduce duplication of code between typing and typing_extensions (#7075)
This commit is contained in:
@@ -35,8 +35,12 @@ 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: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||
|
||||
# This alias for above is kept here for backwards compatibility.
|
||||
runtime = runtime_checkable
|
||||
@@ -51,11 +55,6 @@ Literal: _SpecialForm
|
||||
|
||||
def IntVar(name: str) -> Any: ... # returns a new TypeVar
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
# Technically in 3.6 this inherited from GenericMeta. But let's not reflect that, since
|
||||
# type checkers tend to assume that Protocols all have the ABCMeta metaclass.
|
||||
class _ProtocolMeta(abc.ABCMeta): ...
|
||||
|
||||
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
|
||||
class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
__required_keys__: frozenset[str]
|
||||
|
||||
Reference in New Issue
Block a user