diff options
Diffstat (limited to 'backend/tolData/genPopData.py')
| -rwxr-xr-x | backend/tolData/genPopData.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/backend/tolData/genPopData.py b/backend/tolData/genPopData.py index 9c5382c..3bb1325 100755 --- a/backend/tolData/genPopData.py +++ b/backend/tolData/genPopData.py @@ -1,13 +1,12 @@ #!/usr/bin/python3 -import sys import sqlite3 import argparse -parser = argparse.ArgumentParser(description=''' +parser = argparse.ArgumentParser(description=""" Reads enwiki page view info from a database, and stores it as node popularity values in the database. -''', formatter_class=argparse.RawDescriptionHelpFormatter) +""", formatter_class=argparse.RawDescriptionHelpFormatter) args = parser.parse_args() pageviewsDb = 'enwiki/pageviewData.db' @@ -19,7 +18,7 @@ dbCur = dbCon.cursor() print('Getting view counts') pdbCon = sqlite3.connect(pageviewsDb) pdbCur = pdbCon.cursor() -nodeToViews = {} # Maps node names to counts +nodeToViews: dict[str, int] = {} # Maps node names to counts iterNum = 0 for wikiId, views in pdbCur.execute('SELECT id, views from views'): iterNum += 1 @@ -27,7 +26,7 @@ for wikiId, views in pdbCur.execute('SELECT id, views from views'): print(f'At iteration {iterNum}') # Reached 1.6e6 # row = dbCur.execute('SELECT name FROM wiki_ids WHERE id = ?', (wikiId,)).fetchone() - if row != None: + if row is not None: nodeToViews[row[0]] = views pdbCon.close() |
