diff --git a/dzgui/api/pefile.py b/dzgui/api/pefile.py index 4e77522..7c86987 100644 --- a/dzgui/api/pefile.py +++ b/dzgui/api/pefile.py @@ -1,4 +1,3 @@ -import json import struct from dataclasses import dataclass @@ -404,7 +403,6 @@ def get_pefile_path(steam_path: Path, appid: int) -> Path: return pe_path - def get_pretty_version(steam_path: Path, appid: int) -> str | None: try: pe_file_path = get_pefile_path(steam_path, appid) diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py index d452c81..9c4a941 100644 --- a/dzgui/api/steam.py +++ b/dzgui/api/steam.py @@ -1,12 +1,10 @@ -import json import logging import os import psutil import requests import subprocess -import vdf +import vdf # type: ignore -from shlex import shlex from pathlib import Path from typing import Any, Union from warnings import deprecated @@ -260,7 +258,7 @@ def enqueue_mod(client: str, mod: str, appid: int) -> None: @deprecated("Cf. https://github.com/ValveSoftware/steam-for-linux/issues/9672") -def get_registry() -> dict[str, Any] | None: +def get_registry() -> Any | None: home = os.getenv("HOME") try: with open(f"{home}/.steam/registry.vdf") as f: @@ -294,9 +292,9 @@ def _get_running_app() -> int | None: if registry is None: return None try: - return registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"][ + return int(registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"][ "RunningAppID" - ] + ]) except Exception: return None @@ -319,7 +317,7 @@ def get_running_app() -> int | None: args = proc.cmdline() appid = (row for row in args if FLAG in row) try: - return str(next(appid).split("=")[1]) + return int(next(appid).split("=")[1]) except StopIteration: return None return None diff --git a/dzgui/init/proc.py b/dzgui/init/proc.py index 51678fd..faca556 100644 --- a/dzgui/init/proc.py +++ b/dzgui/init/proc.py @@ -3,11 +3,8 @@ import subprocess import shutil import logging -from warnings import deprecated - from dzgui.const.constants import ( APP_NAME, - DAYZ_BINARY, STEAM_CMD, FLATPAK_APPID, FLATPAK_CMD, @@ -15,8 +12,6 @@ from dzgui.const.constants import ( FLATPAK_SANDBOX, ) -from dzgui.util.format import format_exception - logger = logging.getLogger(APP_NAME) diff --git a/dzgui/managers/mods.py b/dzgui/managers/mods.py index d609378..a28ce28 100644 --- a/dzgui/managers/mods.py +++ b/dzgui/managers/mods.py @@ -141,7 +141,7 @@ class ModManager: app_path_exp = PeFile.get_nested_app_path(steam_path, APPID_DAYZ_EXP) symlink = app_path_exp / md5 symlink.unlink() - except PeFile.AppNotInstalledError: + except Exception: pass time.sleep(API_RATE_LIMIT)