From e7aecb6c06c278a1a5f29325d85a3fdaf4feba9c Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 3 Nov 2021 16:29:35 +0100 Subject: [PATCH] Fixed mypy typing failure @ghostkeeper being nerd snipped It's giving that typing failure because the section variable is re-used. First as elements from self._getSections (strs) and then as elements from sorted_sections.values() (List[PackageModel]s). Python has no variable scopes within functions so the variable still exists after the first for loop. Contributes to CURA-8558 --- plugins/Marketplace/LocalPackageList.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/LocalPackageList.py b/plugins/Marketplace/LocalPackageList.py index 121ac72308..e2a13b051c 100644 --- a/plugins/Marketplace/LocalPackageList.py +++ b/plugins/Marketplace/LocalPackageList.py @@ -62,8 +62,8 @@ class LocalPackageList(PackageList): sorted_sections[section] = sorted(packages, key = lambda p: p.displayName) # Append the order PackageModels to the list - for section in sorted_sections.values(): - for package_data in section: + for sorted_section in sorted_sections.values(): + for package_data in sorted_section: self.appendItem({"package": package_data}) self.setIsLoading(False)