Fix typing bugs

This commit is contained in:
Zomatree
2023-12-29 20:21:48 +00:00
parent 7b95ec1b6b
commit 5a22d6063d
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ class ExtensionProtocol(Protocol):
class CommandsMeta(type):
_commands: list[Command[Any]]
def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]) -> Self:
def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]) -> Any:
commands: list[Command[Any]] = []
self = super().__new__(cls, name, bases, attrs)
+2 -2
View File
@@ -1,7 +1,7 @@
from __future__ import annotations
from typing import Any, Callable, Coroutine, Generic, Optional, TypeVar, cast
from typing_extensions import ParamSpec, Self
from typing_extensions import ParamSpec
from revolt.errors import RevoltError
@@ -18,7 +18,7 @@ class CogMeta(type, Generic[ClientT_D]):
_cog_listeners: dict[str, list[str]]
qualified_name: str
def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any], *, qualified_name: Optional[str] = None, extras: dict[str, Any] | None = None) -> Self:
def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any], *, qualified_name: Optional[str] = None, extras: dict[str, Any] | None = None) -> Any:
commands: list[Command[ClientT_D]] = []
listeners: dict[str, list[str]] = {}
+2 -2
View File
@@ -82,7 +82,7 @@ class WebsocketHandler:
async def send_payload(self, payload: BasePayload) -> None:
if use_msgpack:
await self.websocket.send_bytes(msgpack.packb(payload))
await self.websocket.send_bytes(msgpack.packb(payload)) # type: ignore
else:
await self.websocket.send_str(json.dumps(payload))
@@ -482,7 +482,7 @@ class WebsocketHandler:
if use_msgpack:
data = cast(bytes, msg.data)
payload = msgpack.unpackb(data)
payload = msgpack.unpackb(data) # type: ignore
else:
data = cast(str, msg.data)