[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [gettor/master] Remove useless if condition.



commit a289673e8d2db71d664e4e0fa96fb09b058f35ba
Author: Philipp Winter <phw@xxxxxxxxx>
Date:   Thu Aug 1 22:06:33 2019 -0700

    Remove useless if condition.
    
    abs_filename will always be set because it has a default value.
---
 scripts/add_links_to_db | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/scripts/add_links_to_db b/scripts/add_links_to_db
index c272e4e..fce7025 100755
--- a/scripts/add_links_to_db
+++ b/scripts/add_links_to_db
@@ -90,27 +90,24 @@ def main():
 
     releases = {k: "".join(dic.get(k, version) for dic in (prefixes, versions, suffixes))  for k in keys}
 
-    if not abs_filename:
-        print("Missing database filename.")
-    else:
-        conn = sqlite3.connect(abs_filename)
-        with conn:
-            c = conn.cursor()
-            """
-            Here we drop previous links TABLE but probably it would be better to just update old links to INACTIVE
-            """
-            c.execute("DROP TABLE IF EXISTS links")
-            c.execute(
-                "CREATE TABLE links(link TEXT, platform TEXT, language TEXT, arch TEXT,"
-                " version TEXT, provider TEXT, status TEXT)"
-            )
-            for k in keys:
-                for p in providers:
-                    for l in languages:
-                        release_link = releases.get(k).replace("en-US", l)
-                        c.execute(
-                          "INSERT INTO links(link, platform, language, arch, version, provider, status)"
-                          "VALUES ('%s', '%s', '%s', '64', '%s', '%s', 'ACTIVE')" %(providers.get(p) + release_link, k, l, version, p))
+    conn = sqlite3.connect(abs_filename)
+    with conn:
+        c = conn.cursor()
+        """
+        Here we drop previous links TABLE but probably it would be better to just update old links to INACTIVE
+        """
+        c.execute("DROP TABLE IF EXISTS links")
+        c.execute(
+            "CREATE TABLE links(link TEXT, platform TEXT, language TEXT, arch TEXT,"
+            " version TEXT, provider TEXT, status TEXT)"
+        )
+        for k in keys:
+            for p in providers:
+                for l in languages:
+                    release_link = releases.get(k).replace("en-US", l)
+                    c.execute(
+                        "INSERT INTO links(link, platform, language, arch, version, provider, status)"
+                        "VALUES ('%s', '%s', '%s', '64', '%s', '%s', 'ACTIVE')" %(providers.get(p) + release_link, k, l, version, p))
 
 
 if __name__ == "__main__":



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits