Fix TypeVar argument annotations (#6943)

Arguments like bound= accept type forms like unions, which are not themselves types.
This commit is contained in:
Jelle Zijlstra
2022-01-18 00:14:40 -08:00
committed by GitHub
parent 61d876e4ea
commit ea93779c92

View File

@@ -15,17 +15,12 @@ Any = object()
class TypeVar:
__name__: str
__bound__: Type[Any] | None
__constraints__: Tuple[Type[Any], ...]
__bound__: Any | None
__constraints__: Tuple[Any, ...]
__covariant__: bool
__contravariant__: bool
def __init__(
self,
name: str,
*constraints: Type[Any],
bound: None | Type[Any] | str = ...,
covariant: bool = ...,
contravariant: bool = ...,
self, name: str, *constraints: Any, bound: Any | None = ..., covariant: bool = ..., contravariant: bool = ...
) -> None: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
@@ -75,12 +70,10 @@ if sys.version_info >= (3, 10):
def __init__(self, origin: ParamSpec) -> None: ...
class ParamSpec:
__name__: str
__bound__: Type[Any] | None
__bound__: Any | None
__covariant__: bool
__contravariant__: bool
def __init__(
self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ...
) -> None: ...
def __init__(self, name: str, *, bound: Any | None = ..., contravariant: bool = ..., covariant: bool = ...) -> None: ...
@property
def args(self) -> ParamSpecArgs: ...
@property