Fix type annotations to adhere to latest pyright release

This commit is contained in:
Josh
2022-06-13 05:30:45 +10:00
committed by GitHub
parent 334ef1d7fa
commit c9f777c873
14 changed files with 50 additions and 47 deletions

View File

@ -131,7 +131,7 @@ class _cached_property:
if TYPE_CHECKING:
from functools import cached_property as cached_property
from typing_extensions import ParamSpec, Self
from typing_extensions import ParamSpec, Self, TypeGuard
from .permissions import Permissions
from .abc import Snowflake
@ -624,7 +624,11 @@ async def maybe_coroutine(f: MaybeAwaitableFunc[P, T], *args: P.args, **kwargs:
return value # type: ignore
async def async_all(gen: Iterable[Awaitable[T]], *, check: Callable[[T], bool] = _isawaitable) -> bool:
async def async_all(
gen: Iterable[Union[T, Awaitable[T]]],
*,
check: Callable[[Union[T, Awaitable[T]]], TypeGuard[Awaitable[T]]] = _isawaitable,
) -> bool:
for elem in gen:
if check(elem):
elem = await elem