gnulib-tool.py: Fix 'consider-using-set-comprehension' warnings.
authorCollin Funk <collin.funk1@gmail.com>
Fri, 5 Apr 2024 03:42:09 +0000 (20:42 -0700)
committerBruno Haible <bruno@clisp.org>
Fri, 5 Apr 2024 12:55:02 +0000 (14:55 +0200)
* 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
pygnulib/GLImport.py

index 390d8071abace45a314205d741f5e1a683c81d7a..1d6466d9dac54b0ed029d30f536802d25b84de0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-04-05  Collin Funk  <collin.funk1@gmail.com>
+
+       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  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Fix 'consider-using-with' pylint warnings.
index c6d1a758a4c5feeec27237999382314aef1fb6b5..ee238a1615fc413078ca07908815c2f4e30ce159 100644 (file)
@@ -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)