diff options
| author | AAGaming <aagaming@riseup.net> | 2023-08-26 22:06:01 -0400 |
|---|---|---|
| committer | marios8543 <marios8543@gmail.com> | 2023-10-17 17:08:23 +0300 |
| commit | e2d708a6af0ec75c557b11d3a442af57240302b4 (patch) | |
| tree | 4d784163cc7fe0e7eb12a0a5de75aae1e2a64501 /backend/utilities.py | |
| parent | 1e1e82ed71524ad5cb879e80fc4f7615d59fdba2 (diff) | |
| download | decky-loader-e2d708a6af0ec75c557b11d3a442af57240302b4.tar.gz decky-loader-e2d708a6af0ec75c557b11d3a442af57240302b4.zip | |
begin adding static types to backend code
Diffstat (limited to 'backend/utilities.py')
| -rw-r--r-- | backend/utilities.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/backend/utilities.py b/backend/utilities.py index bcb35578..72b6f008 100644 --- a/backend/utilities.py +++ b/backend/utilities.py @@ -1,26 +1,27 @@ import uuid -import os from json.decoder import JSONDecodeError from os.path import splitext import re from traceback import format_exc -from stat import FILE_ATTRIBUTE_HIDDEN +from stat import FILE_ATTRIBUTE_HIDDEN # type: ignore -from asyncio import sleep, start_server, gather, open_connection +from asyncio import start_server, gather, open_connection from aiohttp import ClientSession, web +from typing import Dict from logging import getLogger +from backend.browser import PluginInstallType +from backend.main import PluginManager from injector import inject_to_tab, get_gamepadui_tab, close_old_tabs, get_tab from pathlib import Path from localplatform import ON_WINDOWS import helpers -import subprocess from localplatform import service_stop, service_start, get_home_path, get_username class Utilities: - def __init__(self, context) -> None: + def __init__(self, context: PluginManager) -> None: self.context = context - self.util_methods = { + self.util_methods: Dict[] = { "ping": self.ping, "http_request": self.http_request, "install_plugin": self.install_plugin, @@ -69,7 +70,7 @@ class Utilities: res["success"] = False return web.json_response(res) - async def install_plugin(self, artifact="", name="No name", version="dev", hash=False, install_type=0): + async def install_plugin(self, artifact="", name="No name", version="dev", hash=False, install_type=PluginInstallType.INSTALL): return await self.context.plugin_browser.request_plugin_install( artifact=artifact, name=name, |
