From e5257703321825d9ca488f7b60e18900b91fd869 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Dec 2021 17:14:02 +0100 Subject: Cast result to list after _updateLocalPackages Because the _updateLocalPackages function guarantees it to be a list now, not None any more. Contributes to issue CURA-8587. --- cura/CuraPackageManager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cura/CuraPackageManager.py') diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 3ef24368fd..e3595ef4bb 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Any, Dict, List, Tuple, TYPE_CHECKING, Optional, Generator +from typing import Any, cast, Dict, List, Tuple, TYPE_CHECKING, Optional, Generator from cura.CuraApplication import CuraApplication #To find some resource types. from cura.Settings.GlobalStack import GlobalStack @@ -30,7 +30,9 @@ class CuraPackageManager(PackageManager): """locally installed packages, lazy execution""" if self._local_packages is None: self._updateLocalPackages() - return self._local_packages + # _updateLocalPackages always results in a list of packages, not None. + # It's guaranteed to be a list now. + return cast(List[Dict[str, Any]], self._local_packages) def initialize(self) -> None: self._installation_dirs_dict["materials"] = Resources.getStoragePath(CuraApplication.ResourceTypes.MaterialInstanceContainer) -- cgit v1.2.3