[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [gettor/master] Harmonise indentation.
commit cfe2a5188155531bf105f64ec7fb4aeb0a33f1e0
Author: Philipp Winter <phw@xxxxxxxxx>
Date: Thu Aug 1 21:55:27 2019 -0700
Harmonise indentation.
Parts of the code was indented with two spaces while the rest was
indented with four spaces. Let's use four spaces everywhere.
---
scripts/add_links_to_db | 126 ++++++++++++++++++++++++------------------------
1 file changed, 63 insertions(+), 63 deletions(-)
diff --git a/scripts/add_links_to_db b/scripts/add_links_to_db
index fb121be..9891d43 100755
--- a/scripts/add_links_to_db
+++ b/scripts/add_links_to_db
@@ -41,69 +41,69 @@ def print_footer():
print("")
def main():
- parser = argparse.ArgumentParser(
- description="Tool to create the gettor SQLite database."
- )
-
- parser.add_argument(
- "-f", "--filename", default="gettor.db", metavar="gettor.db",
- help="Database filename."
- )
-
- args = parser.parse_args()
- abs_filename = os.path.abspath(args.filename)
-
- webFile = request.urlopen("https://www.torproject.org/projects/torbrowser/RecommendedTBBVersions/")
- versions = webFile.read().decode('utf-8').translate({ord(c): None for c in '[]\n" '})
- version = versions.split(",")[-12]
-
- providers = {
- "gitlab": "https://gitlab.com/thetorproject/gettorbrowser/raw/releases/",
- "github": "https://github.com/TheTorProject/gettorbrowser/raw/torbrowser-releases/"
- }
-
-
- prefixes = {
- "osx": "TorBrowser-",
- "windows": "torbrowser-install-",
- "linux": "tor-browser-linux64-"
- }
-
- versions = {"windows": version, 'linux': version, 'osx': version}
-
- suffixes = {
- "osx": "-osx64_en-US.dmg",
- "windows": "_en-US.exe",
- "linux": "_en-US.tar.xz"
- }
-
- keys = ['osx', 'windows', 'linux']
-
- languages = ['en-US', 'es-ES', 'pt-BR']
-
- 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))
+ parser = argparse.ArgumentParser(
+ description="Tool to create the gettor SQLite database."
+ )
+
+ parser.add_argument(
+ "-f", "--filename", default="gettor.db", metavar="gettor.db",
+ help="Database filename."
+ )
+
+ args = parser.parse_args()
+ abs_filename = os.path.abspath(args.filename)
+
+ webFile = request.urlopen("https://www.torproject.org/projects/torbrowser/RecommendedTBBVersions/")
+ versions = webFile.read().decode('utf-8').translate({ord(c): None for c in '[]\n" '})
+ version = versions.split(",")[-12]
+
+ providers = {
+ "gitlab": "https://gitlab.com/thetorproject/gettorbrowser/raw/releases/",
+ "github": "https://github.com/TheTorProject/gettorbrowser/raw/torbrowser-releases/"
+ }
+
+
+ prefixes = {
+ "osx": "TorBrowser-",
+ "windows": "torbrowser-install-",
+ "linux": "tor-browser-linux64-"
+ }
+
+ versions = {"windows": version, 'linux': version, 'osx': version}
+
+ suffixes = {
+ "osx": "-osx64_en-US.dmg",
+ "windows": "_en-US.exe",
+ "linux": "_en-US.tar.xz"
+ }
+
+ keys = ['osx', 'windows', 'linux']
+
+ languages = ['en-US', 'es-ES', 'pt-BR']
+
+ 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))
if __name__ == "__main__":
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits