From: Collin Funk Date: Fri, 5 Apr 2024 03:42:09 +0000 (-0700) Subject: gnulib-tool.py: Fix 'consider-using-set-comprehension' warnings. X-Git-Tag: v1.0~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c216fb8a7b363a7c05dd5ec3b443dcfe407069f;p=thirdparty%2Fgnulib.git gnulib-tool.py: Fix 'consider-using-set-comprehension' warnings. * pygnulib/GLImport.py (GLImport.prepare): Create a set directly instead of creating a list and passing it to a call of set(). (GLImport.__init__): Likewise. Use max() instead of getting the last element of a sorted list. --- diff --git a/ChangeLog b/ChangeLog index 390d8071ab..1d6466d9da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-04-05 Collin Funk + + gnulib-tool.py: Fix 'consider-using-set-comprehension' warnings. + * pygnulib/GLImport.py (GLImport.prepare): Create a set directly instead + of creating a list and passing it to a call of set(). + (GLImport.__init__): Likewise. Use max() instead of getting the last + element of a sorted list. + 2024-04-05 Collin Funk gnulib-tool.py: Fix 'consider-using-with' pylint warnings. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index c6d1a758a4..ee238a1615 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -107,8 +107,8 @@ class GLImport: pattern = re.compile(r'.*AC_PREREQ\((.*)\)', re.M) versions = cleaner(pattern.findall(data)) if versions: - version = sorted(set([ float(version) - for version in versions ]))[-1] + version = max({ float(version) + for version in versions }) self.config.setAutoconfVersion(version) if version < 2.64: raise GLError(4, version) @@ -810,8 +810,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix m4base = self.config['m4base'] lgpl = self.config['lgpl'] verbose = self.config['verbosity'] - base_modules = sorted(set([ self.modulesystem.find(m) - for m in modules ])) + base_modules = sorted({ self.modulesystem.find(m) + for m in modules }) # Perform transitive closure. final_modules = self.moduletable.transitive_closure(base_modules)