mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
typing: update and fix for py310 (#5287)
This commit is contained in:
@@ -20,6 +20,7 @@ from typing import (
|
||||
Tuple,
|
||||
Type as Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
ValuesView,
|
||||
overload as overload,
|
||||
)
|
||||
@@ -96,9 +97,6 @@ if sys.version_info >= (3, 7):
|
||||
Annotated: _SpecialForm = ...
|
||||
_AnnotatedAlias: Any = ... # undocumented
|
||||
|
||||
# TypeAlias is a (non-subscriptable) special form.
|
||||
class TypeAlias: ...
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
@@ -106,12 +104,26 @@ class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
|
||||
|
||||
# PEP 612 support for Python < 3.9
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import Concatenate as Concatenate, ParamSpec as ParamSpec
|
||||
from typing import Concatenate as Concatenate, ParamSpec as ParamSpec, TypeAlias as TypeAlias, TypeGuard as TypeGuard
|
||||
else:
|
||||
class ParamSpecArgs:
|
||||
__origin__: ParamSpec
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
class ParamSpecKwargs:
|
||||
__origin__: ParamSpec
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
class ParamSpec:
|
||||
__name__: str
|
||||
def __init__(self, name: str) -> None: ...
|
||||
__bound__: Optional[Type[Any]]
|
||||
__covariant__: bool
|
||||
__contravariant__: bool
|
||||
def __init__(
|
||||
self, name: str, bound: Union[None, Type[Any], str] = ..., contravariant: bool = ..., covariant: bool = ...
|
||||
) -> None: ...
|
||||
@property
|
||||
def args(self) -> ParamSpecArgs: ...
|
||||
@property
|
||||
def kwargs(self) -> ParamSpecKwargs: ...
|
||||
Concatenate: _SpecialForm = ...
|
||||
|
||||
# PEP 647
|
||||
TypeGuard: _SpecialForm = ...
|
||||
TypeAlias: _SpecialForm = ...
|
||||
TypeGuard: _SpecialForm = ...
|
||||
|
||||
Reference in New Issue
Block a user