mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 13:01:59 +00:00
fix a couple types
This commit is contained in:
@@ -18,6 +18,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
from .injector import get_gamepadui_tab
|
from .injector import get_gamepadui_tab
|
||||||
from .plugin.plugin import PluginWrapper
|
from .plugin.plugin import PluginWrapper
|
||||||
|
from .wsrouter import WSRouter
|
||||||
|
|
||||||
Plugins = dict[str, PluginWrapper]
|
Plugins = dict[str, PluginWrapper]
|
||||||
ReloadQueue = Queue[Tuple[str, str, bool | None] | Tuple[str, str]]
|
ReloadQueue = Queue[Tuple[str, str, bool | None] | Tuple[str, str]]
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class Utilities:
|
|||||||
context.ws.add_route("utilities/get_tab_id", self.get_tab_id)
|
context.ws.add_route("utilities/get_tab_id", self.get_tab_id)
|
||||||
context.ws.add_route("utilities/get_user_info", self.get_user_info)
|
context.ws.add_route("utilities/get_user_info", self.get_user_info)
|
||||||
|
|
||||||
async def _handle_server_method_call(self, request):
|
async def _handle_server_method_call(self, request: web.Request):
|
||||||
method_name = request.match_info["method_name"]
|
method_name = request.match_info["method_name"]
|
||||||
try:
|
try:
|
||||||
args = await request.json()
|
args = await request.json()
|
||||||
@@ -182,7 +182,8 @@ class Utilities:
|
|||||||
style.parentNode.removeChild(style);
|
style.parentNode.removeChild(style);
|
||||||
}})()
|
}})()
|
||||||
""", False)
|
""", False)
|
||||||
|
|
||||||
|
assert result
|
||||||
if "exceptionDetails" in result["result"]:
|
if "exceptionDetails" in result["result"]:
|
||||||
raise result["result"]["exceptionDetails"]
|
raise result["result"]["exceptionDetails"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
from asyncio import AbstractEventLoop, Future, create_task
|
from asyncio import AbstractEventLoop, create_task
|
||||||
|
|
||||||
from aiohttp import WSMsgType, WSMessage
|
from aiohttp import WSMsgType, WSMessage
|
||||||
from aiohttp.web import Application, WebSocketResponse, Request, Response, get
|
from aiohttp.web import Application, WebSocketResponse, Request, Response, get
|
||||||
|
|
||||||
from enum import IntEnum
|
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 dataclasses import dataclass
|
||||||
|
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
@@ -38,7 +38,7 @@ class Message:
|
|||||||
|
|
||||||
DataType = TypeVar("DataType")
|
DataType = TypeVar("DataType")
|
||||||
|
|
||||||
Route = Callable[..., Future[Any]]
|
Route = Callable[..., Coroutine[Any, Any, Any]]
|
||||||
|
|
||||||
class WSRouter:
|
class WSRouter:
|
||||||
def __init__(self, loop: AbstractEventLoop, server_instance: Application) -> None:
|
def __init__(self, loop: AbstractEventLoop, server_instance: Application) -> None:
|
||||||
@@ -133,7 +133,7 @@ class WSRouter:
|
|||||||
return ws
|
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
|
# 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)
|
self.logger.debug('Firing frontend event %s with args %s', data)
|
||||||
|
|
||||||
await self.write({ "type": MessageType.EVENT.value, "event": event, "data": data })
|
await self.write({ "type": MessageType.EVENT.value, "event": event, "data": data })
|
||||||
|
|||||||
Reference in New Issue
Block a user