Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli authored and GitHub committed 2021-08-08 11:05:21 +02:00
1 parent b9adb7a874
commit ee487304d7
578 files changed
+8080 -8966

No files matched your search

+11 -11
View File
@@ -1,6 +1,6 @@
import sys
from types import TracebackType
from typing import Any, Awaitable, Callable, Deque, Generator, Optional, Type, TypeVar, Union
from typing import Any, Awaitable, Callable, Deque, Generator, Type, TypeVar
from .events import AbstractEventLoop
from .futures import Future
@@ -9,19 +9,19 @@ _T = TypeVar("_T")
if sys.version_info >= (3, 9):
class _ContextManagerMixin:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(
self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> Awaitable[None]: ...
else:
class _ContextManager:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
class _ContextManagerMixin:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __init__(self, lock: Lock | Semaphore) -> None: ...
# Apparently this exists to *prohibit* use as a context manager.
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
@@ -29,24 +29,24 @@ else:
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(
self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> Awaitable[None]: ...
class Lock(_ContextManagerMixin):
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> bool: ...
def release(self) -> None: ...
class Event:
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
def is_set(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
async def wait(self) -> bool: ...
class Condition(_ContextManagerMixin):
def __init__(self, lock: Optional[Lock] = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> bool: ...
def release(self) -> None: ...
@@ -58,11 +58,11 @@ class Condition(_ContextManagerMixin):
class Semaphore(_ContextManagerMixin):
_value: int
_waiters: Deque[Future[Any]]
def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> bool: ...
def release(self) -> None: ...
def _wake_up_next(self) -> None: ...
class BoundedSemaphore(Semaphore):
def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...