]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Remove unnecessary conditional.
authorCollin Funk <collin.funk1@gmail.com>
Mon, 8 Apr 2024 05:00:48 +0000 (22:00 -0700)
committerBruno Haible <bruno@clisp.org>
Mon, 8 Apr 2024 18:51:33 +0000 (20:51 +0200)
* pygnulib/GLModuleSystem.py (GLModuleTable.__getitem__): Don't check if
the key is valid twice.

ChangeLog
pygnulib/GLModuleSystem.py

index a6ba2ae992878572a90190792c80cc096c3df137..3beac9b999c4492ef0d9c155ccd8672fb6c035fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-08  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Remove unnecessary conditional.
+       * pygnulib/GLModuleSystem.py (GLModuleTable.__getitem__): Don't check if
+       the key is valid twice.
+
 2024-04-08  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Remove an unused and incorrect function.
index 39976685389fd88cc58f08c46ea7a28d1a602fbe..d3f38c2b663df656d36ecf2d8b6b5cbd0fee1775 100644 (file)
@@ -763,17 +763,16 @@ class GLModuleTable:
 
     def __getitem__(self, y: str) -> list[GLModule]:
         '''x.__getitem__(y) <==> x[y]'''
-        if y in ['base', 'final', 'main', 'tests', 'avoids']:
-            if y == 'base':
-                return self.getBaseModules()
-            elif y == 'final':
-                return self.getFinalModules()
-            elif y == 'main':
-                return self.getMainModules()
-            elif y == 'tests':
-                return self.getTestsModules()
-            else:  # if y == 'avoids'
-                return self.getAvoids()
+        if y == 'base':
+            return self.getBaseModules()
+        elif y == 'final':
+            return self.getFinalModules()
+        elif y == 'main':
+            return self.getMainModules()
+        elif y == 'tests':
+            return self.getTestsModules()
+        elif y == 'avoids':
+            return self.getAvoids()
         else:  # if y is not in list
             raise KeyError('GLModuleTable does not contain key: %s' % repr(y))