From 8b0d1753efc432a29172fb1e6b4daa41af41d6e3 Mon Sep 17 00:00:00 2001 From: marios8543 Date: Tue, 14 Nov 2023 00:34:48 +0200 Subject: fix a couple types --- backend/decky_loader/wsrouter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backend/decky_loader/wsrouter.py') diff --git a/backend/decky_loader/wsrouter.py b/backend/decky_loader/wsrouter.py index b5ed3c2b..034667ae 100644 --- a/backend/decky_loader/wsrouter.py +++ b/backend/decky_loader/wsrouter.py @@ -1,13 +1,13 @@ from logging import getLogger -from asyncio import AbstractEventLoop, Future, create_task +from asyncio import AbstractEventLoop, create_task from aiohttp import WSMsgType, WSMessage from aiohttp.web import Application, WebSocketResponse, Request, Response, get from enum import IntEnum -from typing import Callable, Dict, Any, cast, TypeVar, Type +from typing import Callable, Coroutine, Dict, Any, cast, TypeVar, Type from dataclasses import dataclass from traceback import format_exc @@ -38,7 +38,7 @@ class Message: DataType = TypeVar("DataType") -Route = Callable[..., Future[Any]] +Route = Callable[..., Coroutine[Any, Any, Any]] class WSRouter: def __init__(self, loop: AbstractEventLoop, server_instance: Application) -> None: @@ -133,7 +133,7 @@ class WSRouter: return ws # DataType defaults to None so that if a plugin opts in to strict pyright checking and attempts to pass data witbout specifying the type (or any), the type check fails - async def emit(self, event: str, data: DataType | None = None, data_type: Type[DataType] = None): + async def emit(self, event: str, data: DataType | None = None, data_type: Type[DataType]|None = None): self.logger.debug('Firing frontend event %s with args %s', data) await self.write({ "type": MessageType.EVENT.value, "event": event, "data": data }) -- cgit v1.2.3