Use typing.Self throughout library

This commit is contained in:
Josh
2022-03-01 22:53:24 +10:00
committed by GitHub
parent a90e1824f4
commit 147948af9b
28 changed files with 212 additions and 191 deletions

View File

@ -36,7 +36,7 @@ import sys
import re
import io
from typing import Any, Callable, Generic, IO, Optional, TYPE_CHECKING, Tuple, Type, TypeVar, Union
from typing import Any, Callable, Generic, IO, Optional, TYPE_CHECKING, Tuple, TypeVar, Union
from .enums import SpeakingState
from .errors import ClientException
@ -45,11 +45,12 @@ from .oggparse import OggStream
from .utils import MISSING
if TYPE_CHECKING:
from typing_extensions import Self
from .voice_client import VoiceClient
AT = TypeVar('AT', bound='AudioSource')
FT = TypeVar('FT', bound='FFmpegOpusAudio')
_log = logging.getLogger(__name__)
@ -402,12 +403,12 @@ class FFmpegOpusAudio(FFmpegAudio):
@classmethod
async def from_probe(
cls: Type[FT],
cls,
source: str,
*,
method: Optional[Union[str, Callable[[str, str], Tuple[Optional[str], Optional[int]]]]] = None,
**kwargs: Any,
) -> FT:
) -> Self:
"""|coro|
A factory method that creates a :class:`FFmpegOpusAudio` after probing