diff --git a/discord/voice_client.py b/discord/voice_client.py index 437311122a..61bc0ad9d2 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -46,7 +46,7 @@ import struct import threading import time -from typing import TYPE_CHECKING, Any, Callable +from typing import TYPE_CHECKING, Any, Callable, Literal, overload from . import opus, utils from .backoff import ExponentialBackoff @@ -623,13 +623,33 @@ def get_ssrc(self, user_id): user_id ] + @overload def play( self, source: AudioSource, *, - after: Callable[[Exception | None], Any] = None, - wait_finish: bool = False, + after: Callable[[Exception | None], Any] | None = None, + wait_finish: Literal[False] = False, ) -> None: + ... + + @overload + def play( + self, + source: AudioSource, + *, + after: Callable[[Exception | None], Any] | None = None, + wait_finish: Literal[True], + ) -> asyncio.Future: + ... + + def play( + self, + source: AudioSource, + *, + after: Callable[[Exception | None], Any] | None = None, + wait_finish: bool = False, + ) -> None | asyncio.Future: """Plays an :class:`AudioSource`. The finalizer, ``after`` is called after the source has been exhausted diff --git a/requirements/dev.txt b/requirements/dev.txt index 4aede160f1..537bfcd6fc 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,11 +1,11 @@ -r _.txt pylint~=3.0.3 -pytest~=7.4.3 -pytest-asyncio~=0.23.2 +pytest~=7.4.4 +pytest-asyncio~=0.23.3 # pytest-order~=1.0.1 mypy~=1.8.0 coverage~=7.4 pre-commit==3.5.0 codespell==2.2.6 bandit==1.7.6 -flake8==6.1.0 +flake8==7.0.0