From 2c216fb8a7b363a7c05dd5ec3b443dcfe407069f Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Thu, 4 Apr 2024 20:42:09 -0700 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ pygnulib/GLImport.py | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) 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) -- 2.39.5