mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Add __(r)or__ to various typing classes (#6498)
- `__or__` was added to `TypeVar` in Python 3.10: https://bugs.python.org/issue41428 (this PR: https://github.com/python/cpython/pull/21515) - `__or__` was added to `ForwardRef` in Python 3.11: https://bugs.python.org/issue45489
This commit is contained in:
@@ -29,11 +29,17 @@ class TypeVar:
|
||||
covariant: bool = ...,
|
||||
contravariant: bool = ...,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||
|
||||
_promote = object()
|
||||
|
||||
class _SpecialForm:
|
||||
def __getitem__(self, typeargs: Any) -> object: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_P = _ParamSpec("_P")
|
||||
@@ -80,6 +86,8 @@ if sys.version_info >= (3, 10):
|
||||
def args(self) -> ParamSpecArgs: ...
|
||||
@property
|
||||
def kwargs(self) -> ParamSpecKwargs: ...
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||
Concatenate: _SpecialForm = ...
|
||||
TypeAlias: _SpecialForm = ...
|
||||
TypeGuard: _SpecialForm = ...
|
||||
@@ -727,6 +735,9 @@ if sys.version_info >= (3, 7):
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def is_typeddict(tp: Any) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user