PEP 604: Add ror operator and modify isinstance and subclass (#5509)

Add operators or and ror for types.Union and ror to the type class.
Also, add modified isinstance and issubclass signatures to support old-style and new-style unions inside.
This commit is contained in:
Andrey
2021-05-22 06:30:27 +07:00
committed by GitHub
parent c4e3fd92cc
commit dbaaa3a103
2 changed files with 16 additions and 2 deletions

View File

@@ -352,3 +352,5 @@ if sys.version_info >= (3, 10):
NotImplementedType = _NotImplementedType # noqa F811 from builtins
class Union:
__args__: Tuple[Any, ...]
def __or__(self, obj: Any) -> Union: ...
def __ror__(self, obj: Any) -> Union: ...