diff --git a/plugins/Marketplace/PackageList.py b/plugins/Marketplace/PackageList.py index 6a931c1e4b..665451ba18 100644 --- a/plugins/Marketplace/PackageList.py +++ b/plugins/Marketplace/PackageList.py @@ -4,7 +4,7 @@ import tempfile import json from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, Qt -from typing import Dict, Optional, Set, TYPE_CHECKING +from typing import cast, Dict, Optional, Set, TYPE_CHECKING from UM.i18n import i18nCatalog from UM.Qt.ListModel import ListModel @@ -14,7 +14,7 @@ from UM.Logger import Logger from UM import PluginRegistry from cura.CuraApplication import CuraApplication -from cura import CuraPackageManager +from cura.CuraPackageManager import CuraPackageManager from cura.UltimakerCloud.UltimakerCloudScope import UltimakerCloudScope # To make requests to the Ultimaker API with correct authorization. from .PackageModel import PackageModel @@ -22,6 +22,7 @@ from .Constants import USER_PACKAGES_URL if TYPE_CHECKING: from PyQt5.QtCore import QObject + from PyQt5.QtNetwork import QNetworkReply catalog = i18nCatalog("cura") @@ -35,7 +36,7 @@ class PackageList(ListModel): def __init__(self, parent: Optional["QObject"] = None) -> None: super().__init__(parent) - self._manager: CuraPackageManager = CuraApplication.getInstance().getPackageManager() + self._manager: CuraPackageManager = cast(CuraPackageManager, CuraApplication.getInstance().getPackageManager()) self._plugin_registry: PluginRegistry = CuraApplication.getInstance().getPluginRegistry() self._account = CuraApplication.getInstance().getCuraAPI().account self._error_message = "" diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 92daf310a3..f7682340c9 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -71,11 +71,13 @@ class PackageModel(QObject): self.sdk_version = package_data.get("sdk_version_semver", "") # Note that there's a lot more info in the package_data than just these specified here. - def __eq__(self, other: Union[str, "PackageModel"]): + def __eq__(self, other: object): if isinstance(other, PackageModel): return other == self - else: + elif isinstance(other, str): return other == self._package_id + else: + return False def __repr__(self): return f"<{self._package_id} : {self._package_version} : {self._section_title}>"