[Blends-commit] [SCM] website branch, master, updated. acdee38caffd3aa47fa3a8c8c6d6ff0db39a6bda

Ole Streicher olebole at debian.org
Sun Mar 6 09:16:11 UTC 2016


The following commit has been merged in the master branch:
commit acdee38caffd3aa47fa3a8c8c6d6ff0db39a6bda
Author: Ole Streicher <olebole at debian.org>
Date:   Sun Mar 6 10:16:08 2016 +0100

    Use implicite loops in blendstasktools

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 84a7aa1..a57c00f 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -500,29 +500,15 @@ _execute_udd_query(query)
 
 #########################################################################################
 
-def List2PgArray(list):
+def List2PgArray(l):
     # turn a list of strings into the syntax for a PostgreSQL array:
     # {"string1","string2",...,"stringN"}
-    if not list:
-        return '{}'
-    komma='{'
-    PgArray=''
-    for s in list:
-        PgArray=PgArray+komma+'"'+s+'"'
-        komma=','
-    return PgArray+'}'
-
-def List2PgSimilarArray(list):
+    return '{' + ','.join(('"' + s + '"') for s in l) + '}'
+
+def List2PgSimilarArray(l):
     # turn a list of strings surrounded by '%' into the syntax for a PostgreSQL array to enable LIKE conditions:
     # {"%string1%","%string2%",...,"%stringN%"}
-    if not list:
-        return '{}'
-    komma='{'
-    PgSimArray=''
-    for s in list:
-        PgSimArray=PgSimArray+komma+'"%'+s+'%"'
-        komma=','
-    return PgSimArray+'}'
+    return '{' + ','.join(('"%' + s + '%"') for s in l) + '}'
 
 def ReadConfig(blendname=''):
     # Try to read config file CONFDIR/<blendname>.conf
@@ -888,11 +874,10 @@ class Tasks:
 
     def _InitMetapackages(self):
         # sorted list of metapackage names
-        self.metapackagekeys = []
-        for task in os.listdir(self.tasksdir):
-            if os.path.isfile(os.path.join(self.tasksdir, task)):
-                self.metapackagekeys.append(task)
-        self.metapackagekeys.sort()
+        self.metapackagekeys = sorted(
+            task for task in os.listdir(self.tasksdir)
+            if os.path.isfile(os.path.join(self.tasksdir, task))
+        )
 
     def GetAllDependencies(self, source=0):
         # If we want to subscribe ddpo we need the source package names.

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list