diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-12-06 19:14:02 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-12-06 19:14:02 +0300 |
commit | e5257703321825d9ca488f7b60e18900b91fd869 (patch) | |
tree | 5f91cb02bc0d02882a400e5afbd3188b49ecea48 /cura | |
parent | f932239b6a0ecdb8a227b02878e8ddc4ff4e4fbe (diff) |
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.
Diffstat (limited to 'cura')
-rw-r--r-- | cura/CuraPackageManager.py | 6 |
1 files changed, 4 insertions, 2 deletions
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) |