add verbose prints back to core repo
authorgamesguru <mathmuncher11@gmail.com>
Tue, 16 Mar 2021 13:27:54 +0000 (09:27 -0400)
committergamesguru <mathmuncher11@gmail.com>
Tue, 16 Mar 2021 13:27:54 +0000 (09:27 -0400)
__init__.py
sql/__init__.py

index 0e5c533cde039c0cd5cd802874ddb76ea9e2c8ae..1a4c548aca2ae7f57a6204c4c489ab47d3c312e3 100755 (executable)
@@ -4,4 +4,4 @@
 if __name__ == "__main__":
     from sql import build_ntsqlite
 
-    build_ntsqlite()
+    build_ntsqlite(verbose=True)
index 0a3abd8274630b3bfda66ef89317058d7afcce04..7c6633bb7556648a1bb26d9477f5320f1532adcf 100644 (file)
@@ -6,24 +6,28 @@ import sqlite3
 NT_DB_NAME = "nt.sqlite"
 
 
-def build_ntsqlite():
+def build_ntsqlite(verbose=False):
     # cd into this script's directory
     SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
     os.chdir(SCRIPT_DIR)
 
-    # print("Cleanup...")
+    if verbose:
+        print("Cleanup...")
     if os.path.isfile(NT_DB_NAME):
         os.remove(NT_DB_NAME)
 
-    # print(f"\nPack {NT_DB_NAME}")
+    if verbose:
+        print(f"\nPack {NT_DB_NAME}")
     con = sqlite3.connect(NT_DB_NAME)
     cur = con.cursor()
 
-    # print("\n-> Create tables")
+    if verbose:
+        print("\n-> Create tables")
     with open("tables.sql") as tables:
         cur.executescript(tables.read())
 
-    # print("-> Populate data")
+    if verbose:
+        print("-> Populate data")
     for p in os.listdir("data"):
         if not p.endswith(".csv"):
             continue
@@ -40,7 +44,8 @@ def build_ntsqlite():
     cur.close()
     con.commit()
     con.close()
-    # print("\nDone!")
+    if verbose:
+        print("\nDone!")
     return True