From 4e7248a7becc02ddac72b0ec734dde89a174901c Mon Sep 17 00:00:00 2001 From: Mieszko Date: Wed, 4 May 2022 23:56:59 +0200 Subject: [PATCH] fix mypy issues --- src/humbleapp/__init__.py | 1 - src/humbleapp/humbleapp.py | 3 ++- src/library.py | 1 - src/local/humbleapp_adapter.py | 8 ++++---- src/plugin.py | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/humbleapp/__init__.py b/src/humbleapp/__init__.py index 2ce959ad..e69de29b 100644 --- a/src/humbleapp/__init__.py +++ b/src/humbleapp/__init__.py @@ -1 +0,0 @@ -from humbleapp import * diff --git a/src/humbleapp/humbleapp.py b/src/humbleapp/humbleapp.py index 5bf83b7b..6392953b 100644 --- a/src/humbleapp/humbleapp.py +++ b/src/humbleapp/humbleapp.py @@ -51,6 +51,7 @@ class VaultGame: def full_executable_path(self) -> t.Optional[pathlib.Path]: if self.file_path and self.executable_path: return pathlib.Path(self.file_path) / self.executable_path + return None @dataclass @@ -90,7 +91,7 @@ def has_changed(self) -> t.Optional[bool]: try: last_mtime = os.stat(self._path).st_mtime except OSError: - self._prev_mtime = None + self._prev_mtime = 0.0 return None changed = last_mtime != self._prev_mtime self._prev_mtime = last_mtime diff --git a/src/library.py b/src/library.py index 74901fe8..2babd7bd 100644 --- a/src/library.py +++ b/src/library.py @@ -1,6 +1,5 @@ from functools import reduce from math import ceil -import time import logging import asyncio from typing import Callable, Dict, List, Sequence, Set, Iterable, Any, Coroutine, NamedTuple, TypeVar, Generator diff --git a/src/local/humbleapp_adapter.py b/src/local/humbleapp_adapter.py index 014e4a22..904c4d32 100644 --- a/src/local/humbleapp_adapter.py +++ b/src/local/humbleapp_adapter.py @@ -77,17 +77,17 @@ def refresh_game_list(self) -> None: def _parse_config(self) -> t.Optional[HumbleAppConfig]: if self._config.has_changed(): - return parse_humble_app_config(str(self.CONFIG_PATH)) + return parse_humble_app_config(self.CONFIG_PATH) return None def get_local_size(self, game_id: str) -> t.Optional[int]: game = self._games.get(game_id) if game is None: return None - if os.path.exists(game.file_path): - return game.file_size - else: + if game.file_path and not os.path.exists(game.file_path): return 0 + else: + return game.file_size def is_installed(self) -> bool: return self._client.is_installed() diff --git a/src/plugin.py b/src/plugin.py index cc160acd..959d5cf1 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -17,7 +17,7 @@ from sentry_sdk.integrations.logging import LoggingIntegration from galaxy.api.plugin import Plugin, create_and_run_plugin from galaxy.api.consts import Platform, OSCompatibility -from galaxy.api.types import Authentication, NextStep, LocalGame, GameLibrarySettings, Subscription, SubscriptionDiscovery, SubscriptionGame +from galaxy.api.types import Authentication, NextStep, LocalGame, GameLibrarySettings, Subscription, SubscriptionGame from galaxy.api.errors import AuthenticationRequired, UnknownBackendResponse, UnknownError, BackendError from consts import IS_WINDOWS, TROVE_SUBSCRIPTION_NAME