From 691d013eb09e3d0bf5015d6a6ce08e2709c9d22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= Date: Thu, 18 Jul 2024 11:26:23 +0100 Subject: [PATCH] Do not use list comprehension in favor of more efficient way --- python/spacewalk/server/importlib/packageImport.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/spacewalk/server/importlib/packageImport.py b/python/spacewalk/server/importlib/packageImport.py index 96076af6fd44..71b12c73dc3e 100644 --- a/python/spacewalk/server/importlib/packageImport.py +++ b/python/spacewalk/server/importlib/packageImport.py @@ -339,10 +339,12 @@ def _processPackage(self, package): if fchecksumTuple not in self.checksums: self.checksums[fchecksumTuple] = None - package["is_ptf"] = any([x[0] == "ptf()" for x in self.capabilities.keys()]) - package["is_part_of_ptf"] = any( - [x[0] == "ptf-package()" for x in self.capabilities.keys()] - ) + # Check whether package is a PTF or part of PTF + for cap in self.capabilities.keys(): + if cap[0] == "ptf()": + package["is_ptf"] = True + elif cap[0] == "ptf-package()": + package["is_part_of_ptf"] = True # Uniquify changelog entries unique_package_changelog_hash = set()