Type up **kwargs of various methods

This commit is contained in:
Nadir Chowdhury
2021-05-11 01:24:48 +01:00
committed by GitHub
parent 8bc489dba8
commit 757cfad38f
14 changed files with 453 additions and 72 deletions

View File

@ -42,6 +42,7 @@ import socket
import logging
import struct
import threading
from typing import Any, Callable
from . import opus, utils
from .backoff import ExponentialBackoff
@ -121,7 +122,7 @@ class VoiceProtocol:
"""
raise NotImplementedError
async def connect(self, *, timeout, reconnect):
async def connect(self, *, timeout: float, reconnect: bool):
"""|coro|
An abstract method called when the client initiates the connection request.
@ -144,7 +145,7 @@ class VoiceProtocol:
"""
raise NotImplementedError
async def disconnect(self, *, force):
async def disconnect(self, *, force: bool):
"""|coro|
An abstract method called when the client terminates the connection.
@ -328,7 +329,7 @@ class VoiceClient(VoiceProtocol):
self._connected.set()
return ws
async def connect(self, *, reconnect, timeout):
async def connect(self, *, reconnect: bool, timeout: bool):
log.info('Connecting to voice...')
self.timeout = timeout
@ -451,7 +452,7 @@ class VoiceClient(VoiceProtocol):
log.warning('Could not connect to voice... Retrying...')
continue
async def disconnect(self, *, force=False):
async def disconnect(self, *, force: bool = False):
"""|coro|
Disconnects this voice client from voice.
@ -525,7 +526,7 @@ class VoiceClient(VoiceProtocol):
return header + box.encrypt(bytes(data), bytes(nonce)).ciphertext + nonce[:4]
def play(self, source, *, after=None):
def play(self, source: AudioSource, *, after: Callable[[Exception], Any]=None):
"""Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted